Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1ce92dc2
Commit
1ce92dc2
authored
Feb 24, 2011
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #11286: Fixed unpickling of empty 2.x strings.
parent
6c3787cb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
13 deletions
+12
-13
Lib/test/pickletester.py
Lib/test/pickletester.py
+4
-0
Lib/test/test_pickle.py
Lib/test/test_pickle.py
+6
-6
Lib/test/test_pickletools.py
Lib/test/test_pickletools.py
+2
-2
Modules/_pickle.c
Modules/_pickle.c
+0
-5
No files found.
Lib/test/pickletester.py
View file @
1ce92dc2
...
@@ -1094,6 +1094,10 @@ class AbstractPickleTests(unittest.TestCase):
...
@@ -1094,6 +1094,10 @@ class AbstractPickleTests(unittest.TestCase):
self
.
assertEqual
(
len
(
loaded
),
len
(
data
))
self
.
assertEqual
(
len
(
loaded
),
len
(
data
))
self
.
assertEqual
(
loaded
,
data
)
self
.
assertEqual
(
loaded
,
data
)
def
test_empty_bytestring
(
self
):
# issue 11286
empty
=
self
.
loads
(
b'
\
x80
\
x03
U
\
x00
q
\
x00
.'
,
encoding
=
'koi8-r'
)
self
.
assertEqual
(
empty
,
''
)
# Test classes for reduce_ex
# Test classes for reduce_ex
...
...
Lib/test/test_pickle.py
View file @
1ce92dc2
...
@@ -31,9 +31,9 @@ class PyPicklerTests(AbstractPickleTests):
...
@@ -31,9 +31,9 @@ class PyPicklerTests(AbstractPickleTests):
f
.
seek
(
0
)
f
.
seek
(
0
)
return
bytes
(
f
.
read
())
return
bytes
(
f
.
read
())
def
loads
(
self
,
buf
):
def
loads
(
self
,
buf
,
**
kwds
):
f
=
io
.
BytesIO
(
buf
)
f
=
io
.
BytesIO
(
buf
)
u
=
self
.
unpickler
(
f
)
u
=
self
.
unpickler
(
f
,
**
kwds
)
return
u
.
load
()
return
u
.
load
()
...
@@ -45,8 +45,8 @@ class InMemoryPickleTests(AbstractPickleTests):
...
@@ -45,8 +45,8 @@ class InMemoryPickleTests(AbstractPickleTests):
def
dumps
(
self
,
arg
,
proto
=
None
):
def
dumps
(
self
,
arg
,
proto
=
None
):
return
pickle
.
dumps
(
arg
,
proto
)
return
pickle
.
dumps
(
arg
,
proto
)
def
loads
(
self
,
buf
):
def
loads
(
self
,
buf
,
**
kwds
):
return
pickle
.
loads
(
buf
)
return
pickle
.
loads
(
buf
,
**
kwds
)
class
PyPersPicklerTests
(
AbstractPersistentPicklerTests
):
class
PyPersPicklerTests
(
AbstractPersistentPicklerTests
):
...
@@ -64,12 +64,12 @@ class PyPersPicklerTests(AbstractPersistentPicklerTests):
...
@@ -64,12 +64,12 @@ class PyPersPicklerTests(AbstractPersistentPicklerTests):
f
.
seek
(
0
)
f
.
seek
(
0
)
return
f
.
read
()
return
f
.
read
()
def
loads
(
self
,
buf
):
def
loads
(
self
,
buf
,
**
kwds
):
class
PersUnpickler
(
self
.
unpickler
):
class
PersUnpickler
(
self
.
unpickler
):
def
persistent_load
(
subself
,
obj
):
def
persistent_load
(
subself
,
obj
):
return
self
.
persistent_load
(
obj
)
return
self
.
persistent_load
(
obj
)
f
=
io
.
BytesIO
(
buf
)
f
=
io
.
BytesIO
(
buf
)
u
=
PersUnpickler
(
f
)
u
=
PersUnpickler
(
f
,
**
kwds
)
return
u
.
load
()
return
u
.
load
()
...
...
Lib/test/test_pickletools.py
View file @
1ce92dc2
...
@@ -9,8 +9,8 @@ class OptimizedPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
...
@@ -9,8 +9,8 @@ class OptimizedPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
def
dumps
(
self
,
arg
,
proto
=
None
):
def
dumps
(
self
,
arg
,
proto
=
None
):
return
pickletools
.
optimize
(
pickle
.
dumps
(
arg
,
proto
))
return
pickletools
.
optimize
(
pickle
.
dumps
(
arg
,
proto
))
def
loads
(
self
,
buf
):
def
loads
(
self
,
buf
,
**
kwds
):
return
pickle
.
loads
(
buf
)
return
pickle
.
loads
(
buf
,
**
kwds
)
# Test relies on precise output of dumps()
# Test relies on precise output of dumps()
test_pickle_to_2x
=
None
test_pickle_to_2x
=
None
...
...
Modules/_pickle.c
View file @
1ce92dc2
...
@@ -977,11 +977,6 @@ _Unpickler_Read(UnpicklerObject *self, char **s, Py_ssize_t n)
...
@@ -977,11 +977,6 @@ _Unpickler_Read(UnpicklerObject *self, char **s, Py_ssize_t n)
{
{
Py_ssize_t
num_read
;
Py_ssize_t
num_read
;
if
(
n
==
0
)
{
*
s
=
NULL
;
return
0
;
}
if
(
self
->
next_read_idx
+
n
<=
self
->
input_len
)
{
if
(
self
->
next_read_idx
+
n
<=
self
->
input_len
)
{
*
s
=
self
->
input_buffer
+
self
->
next_read_idx
;
*
s
=
self
->
input_buffer
+
self
->
next_read_idx
;
self
->
next_read_idx
+=
n
;
self
->
next_read_idx
+=
n
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment