classification
Title: Fix default argument handling for buffers argument in pickle.loads
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Markus Mohrhard, aeros167, miss-islington, pitrou, xtreak
Priority: normal Keywords: patch

Created on 2019-07-05 03:33 by Markus Mohrhard, last changed 2019-07-25 16:20 by pitrou. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 14593 merged Markus Mohrhard, 2019-07-05 03:36
PR 14948 merged miss-islington, 2019-07-25 16:00
Messages (6)
msg347299 - (view) Author: Markus Mohrhard (Markus Mohrhard) * Date: 2019-07-05 03:33
The following piece of code

import pickle
pickle.loads(pickle.dumps(1, protocol=pickle.HIGHEST_PROTOCOL), buffers=None)

fails with "TypeError: 'NoneType' object is not iterable"

The corresponding PEP (https://www.python.org/dev/peps/pep-0574/) specifies that buffer=None is the default but the C implementation does not check for Py_None.

The PR contains a test for this case that fails without the fix.
msg347303 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python triager) Date: 2019-07-05 04:05
See also issue37210
msg347306 - (view) Author: Markus Mohrhard (Markus Mohrhard) * Date: 2019-07-05 04:24
Sorr, I somehow managed to overwrite my title before submitting with the one from one if the results of my searches.
msg347484 - (view) Author: Kyle Stanley (aeros167) * Date: 2019-07-08 03:45
Thanks for reporting the issue. On PR-14593 I reviewed the changes with interpreter screenshots showing the output of "pickle.loads(pickle.dumps(1, protocol=pickle.HIGHEST_PROTOCOL), buffers=None)" in the latest version of cpython master compared to the branch from the PR.
msg348440 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2019-07-25 16:00
New changeset 898318b53d921298d1f1fcfa0f415844afbeb318 by Antoine Pitrou (Markus Mohrhard) in branch 'master':
bpo-37502: handle default parameter for buffers argument of pickle.loads correctly (GH-14593)
https://github.com/python/cpython/commit/898318b53d921298d1f1fcfa0f415844afbeb318
msg348442 - (view) Author: miss-islington (miss-islington) Date: 2019-07-25 16:18
New changeset 25cb4fd4fb0f44d2b6bf38379634f3d22b77aa17 by Miss Islington (bot) in branch '3.8':
bpo-37502: handle default parameter for buffers argument of pickle.loads correctly (GH-14593)
https://github.com/python/cpython/commit/25cb4fd4fb0f44d2b6bf38379634f3d22b77aa17
History
Date User Action Args
2019-07-25 16:20:52pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-07-25 16:18:23miss-islingtonsetnosy: + miss-islington
messages: + msg348442
2019-07-25 16:00:48miss-islingtonsetpull_requests: + pull_request14718
2019-07-25 16:00:38pitrousetmessages: + msg348440
2019-07-08 03:45:11aeros167setnosy: + aeros167
messages: + msg347484
2019-07-05 04:24:54Markus Mohrhardsetmessages: + msg347306
2019-07-05 04:23:50Markus Mohrhardsettitle: Pure Python pickle module should not depend on _pickle.PickleBuffer -> Fix default argument handling for buffers argument in pickle.loads
2019-07-05 04:05:19xtreaksetnosy: + xtreak, pitrou
messages: + msg347303
2019-07-05 03:36:19Markus Mohrhardsetkeywords: + patch
stage: patch review
pull_requests: + pull_request14409
2019-07-05 03:33:14Markus Mohrhardcreate