Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default argument handling for buffers argument in pickle.loads #81683

Closed
mmohrhard mannequin opened this issue Jul 5, 2019 · 6 comments
Closed

Fix default argument handling for buffers argument in pickle.loads #81683

mmohrhard mannequin opened this issue Jul 5, 2019 · 6 comments
Labels
3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir

Comments

@mmohrhard
Copy link
Mannequin

mmohrhard mannequin commented Jul 5, 2019

BPO 37502
Nosy @pitrou, @miss-islington, @tirkarthi, @aeros, @mmohrhard
PRs
  • bpo-37502: handle default parameter for buffers argument of pickle.loads #14593
  • [3.8] bpo-37502: handle default parameter for buffers argument of pickle.loads correctly (GH-14593) #14948
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-07-25.16:20:52.726>
    created_at = <Date 2019-07-05.03:33:14.844>
    labels = ['3.8', 'library', '3.9']
    title = 'Fix default argument handling for buffers argument in pickle.loads'
    updated_at = <Date 2019-07-25.16:20:52.725>
    user = 'https://github.com/mmohrhard'

    bugs.python.org fields:

    activity = <Date 2019-07-25.16:20:52.725>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-07-25.16:20:52.726>
    closer = 'pitrou'
    components = ['Library (Lib)']
    creation = <Date 2019-07-05.03:33:14.844>
    creator = 'Markus Mohrhard'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37502
    keywords = ['patch']
    message_count = 6.0
    messages = ['347299', '347303', '347306', '347484', '348440', '348442']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'miss-islington', 'xtreak', 'aeros', 'Markus Mohrhard']
    pr_nums = ['14593', '14948']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue37502'
    versions = ['Python 3.8', 'Python 3.9']

    @mmohrhard
    Copy link
    Mannequin Author

    mmohrhard mannequin commented Jul 5, 2019

    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.

    @mmohrhard mmohrhard mannequin added 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir labels Jul 5, 2019
    @tirkarthi
    Copy link
    Member

    See also bpo-37210

    @mmohrhard mmohrhard mannequin changed the title Pure Python pickle module should not depend on _pickle.PickleBuffer Fix default argument handling for buffers argument in pickle.loads Jul 5, 2019
    @mmohrhard
    Copy link
    Mannequin Author

    mmohrhard mannequin commented Jul 5, 2019

    Sorr, I somehow managed to overwrite my title before submitting with the one from one if the results of my searches.

    @aeros
    Copy link
    Contributor

    aeros commented Jul 8, 2019

    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.

    @pitrou
    Copy link
    Member

    pitrou commented Jul 25, 2019

    New changeset 898318b by Antoine Pitrou (Markus Mohrhard) in branch 'master':
    bpo-37502: handle default parameter for buffers argument of pickle.loads correctly (GH-14593)
    898318b

    @miss-islington
    Copy link
    Contributor

    New changeset 25cb4fd by Miss Islington (bot) in branch '3.8':
    bpo-37502: handle default parameter for buffers argument of pickle.loads correctly (GH-14593)
    25cb4fd

    @pitrou pitrou closed this as completed Jul 25, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants