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

Pickle nested names with protocols < 4 #67799

Closed
serhiy-storchaka opened this issue Mar 8, 2015 · 9 comments
Closed

Pickle nested names with protocols < 4 #67799

serhiy-storchaka opened this issue Mar 8, 2015 · 9 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 23611
Nosy @pitrou, @vstinner, @avassalotti, @serhiy-storchaka
Files
  • pickle_nested_names_2.patch
  • 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 = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2015-03-31.16:49:01.881>
    created_at = <Date 2015-03-08.17:50:40.420>
    labels = ['type-feature', 'library']
    title = 'Pickle nested names with protocols < 4'
    updated_at = <Date 2015-03-31.16:49:01.881>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2015-03-31.16:49:01.881>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2015-03-31.16:49:01.881>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2015-03-08.17:50:40.420>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['38393']
    hgrepos = []
    issue_num = 23611
    keywords = ['patch']
    message_count = 9.0
    messages = ['237548', '237567', '237568', '239362', '239364', '239368', '239389', '239683', '239711']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'vstinner', 'alexandre.vassalotti', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue23611'
    versions = ['Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    Proposed patch allows Python implementation of the pickle module to pickle nested names (e.g. methods) with protocols < 4. Pickled data is compatible with old releases.

    If this is good I'll write C implementation.

    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Mar 8, 2015
    @serhiy-storchaka
    Copy link
    Member Author

    Fixed few bugs and added C implementation.

    @pitrou
    Copy link
    Member

    pitrou commented Mar 8, 2015

    Interesting. I have only skimmed through the patch, but +1 on the principle.

    @serhiy-storchaka serhiy-storchaka self-assigned this Mar 24, 2015
    @vstinner
    Copy link
    Member

    Hum, I don't know well the pickle module. Is it backward compatible? Should Python 2 be able to unserialize data serialized by Python 3? If yes, can you patch break this compatibility?

    It is unclear to me if it makes sense to even modify protocols different than the latest version.

    @serhiy-storchaka
    Copy link
    Member Author

    Pickle is backward compatible and Python 2 usually is able to unpickle data pickled by Python 3 with protocol < 3. The patch doesn't break compatibility. Current default protocol is 3 for compatibility with older Python 3 versions. It is used in multiprocessing and this is not configurable.

    @vstinner
    Copy link
    Member

    It is used in multiprocessing and this is not configurable.

    Oh, it would be nice to switch to version 4 by default, or make it
    configurable. I read that the version 4 is faster.

    @serhiy-storchaka
    Copy link
    Member Author

    bpo-23403. But looks it is early yet for this.

    Note that this patch doesn't modify protocols. It just makes the pickler more smart and able to serialize more objects with existing protocols. It is the same as add pickle support for some type that didn't support the pickling before.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 31, 2015

    New changeset ca12465418bd by Serhiy Storchaka in branch 'default':
    Issue bpo-23611: Serializing more "lookupable" objects (such as unbound methods
    https://hg.python.org/cpython/rev/ca12465418bd

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 31, 2015

    New changeset f78b9f700d45 by Serhiy Storchaka in branch 'default':
    Issue bpo-23611: Fixed enums pickling tests. Now all picklings work with all
    https://hg.python.org/cpython/rev/f78b9f700d45

    @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
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants