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
898318b5
Commit
898318b5
authored
Jul 26, 2019
by
Markus Mohrhard
Committed by
Antoine Pitrou
Jul 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37502: handle default parameter for buffers argument of pickle.loads correctly (GH-14593)
parent
93e8aa62
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
1 deletion
+7
-1
Lib/test/pickletester.py
Lib/test/pickletester.py
+5
-0
Misc/NEWS.d/next/Library/2019-07-08-03-15-04.bpo-37502.qZGC4g.rst
...S.d/next/Library/2019-07-08-03-15-04.bpo-37502.qZGC4g.rst
+1
-0
Modules/_pickle.c
Modules/_pickle.c
+1
-1
No files found.
Lib/test/pickletester.py
View file @
898318b5
...
...
@@ -2765,6 +2765,11 @@ class AbstractPickleTests(unittest.TestCase):
with
self
.
assertRaises
(
pickle
.
UnpicklingError
):
self
.
loads
(
data
,
buffers
=
[])
def
test_inband_accept_default_buffers_argument
(
self
):
for
proto
in
range
(
5
,
pickle
.
HIGHEST_PROTOCOL
+
1
):
data_pickled
=
self
.
dumps
(
1
,
proto
,
buffer_callback
=
None
)
data
=
self
.
loads
(
data_pickled
,
buffers
=
None
)
@
unittest
.
skipIf
(
np
is
None
,
"Test needs Numpy"
)
def
test_buffers_numpy
(
self
):
def
check_no_copy
(
x
,
y
):
...
...
Misc/NEWS.d/next/Library/2019-07-08-03-15-04.bpo-37502.qZGC4g.rst
0 → 100644
View file @
898318b5
pickle.loads() no longer raises TypeError when the buffers argument is set to None
Modules/_pickle.c
View file @
898318b5
...
...
@@ -1653,7 +1653,7 @@ _Unpickler_SetInputEncoding(UnpicklerObject *self,
static
int
_Unpickler_SetBuffers
(
UnpicklerObject
*
self
,
PyObject
*
buffers
)
{
if
(
buffers
==
NULL
)
{
if
(
buffers
==
NULL
||
buffers
==
Py_None
)
{
self
->
buffers
=
NULL
;
}
else
{
...
...
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