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
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
GitHub fields:
assignee = 'https://github.com/serhiy-storchaka' closed_at = <Date 2017-08-05.15:24:03.870> created_at = <Date 2017-08-02.18:53:14.769> labels = ['3.7', 'type-bug', 'library'] title = 'copyreg does not properly mangle __slots__ names' updated_at = <Date 2017-08-05.15:24:03.861> user = 'https://github.com/ShaneHarvey'
bugs.python.org fields:
activity = <Date 2017-08-05.15:24:03.861> actor = 'serhiy.storchaka' assignee = 'serhiy.storchaka' closed = True closed_date = <Date 2017-08-05.15:24:03.870> closer = 'serhiy.storchaka' components = ['Library (Lib)'] creation = <Date 2017-08-02.18:53:14.769> creator = 'ShaneHarvey' dependencies = [] files = [] hgrepos = [] issue_num = 31107 keywords = [] message_count = 4.0 messages = ['299665', '299737', '299787', '299788'] nosy_count = 2.0 nosy_names = ['serhiy.storchaka', 'ShaneHarvey'] pr_nums = ['2989', '3003', '3004'] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue31107' versions = ['Python 2.7', 'Python 3.6', 'Python 3.7']
The text was updated successfully, but these errors were encountered:
This line in copyreg._slotnames does not properly calculate mangled attribute names: https://github.com/python/cpython/blob/v3.6.2/Lib/copyreg.py#L131
The problem is that it does not strip leading underscores from the class name:
>>> class _LeadingUnderscoreClassName(object): ... __slots__ = ("__bar",) ... >>> import copy_reg >>> copy_reg._slotnames(_LeadingUnderscoreClassName) ['__LeadingUnderscoreClassName__bar']
The result is that copy, pickle, and anything else that relies on _slotnames() do not work on classes with leading underscores and private __slots__. This bug is present in all versions of Python.
Sorry, something went wrong.
New changeset c4c9866 by Serhiy Storchaka (Shane Harvey) in branch 'master': bpo-31107: Fix copyreg mangled slot names calculation. (bpo-2989) c4c9866
New changeset 4795ba8 by Serhiy Storchaka (Shane Harvey) in branch '3.6': [3.6] bpo-31107: Fix copyreg mangled slot names calculation. (GH-2989) (bpo-3003) 4795ba8
New changeset 88ffff5 by Serhiy Storchaka (Shane Harvey) in branch '2.7': [2.7] bpo-31107: Fix copyreg mangled slot names calculation. (GH-2989). (bpo-3004) 88ffff5
serhiy-storchaka
No branches or pull requests
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: