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

bpo-31107: Fix copyreg mangled slot names calculation. #2989

Merged
merged 3 commits into from
Aug 4, 2017

Conversation

ShaneHarvey
Copy link
Contributor

@ShaneHarvey ShaneHarvey commented Aug 2, 2017

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

Lib/copyreg.py Outdated
@@ -128,7 +128,7 @@ class found there. (This assumes classes don't modify their
continue
# mangled names
elif name.startswith('__') and not name.endswith('__'):
names.append('_%s%s' % (c.__name__, name))
names.append('_%s%s' % (c.__name__.lstrip('_'), name))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name shouldn't be mangled if c.__name__.lstrip('_') is an empty string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, I wasn't aware of that case.

@serhiy-storchaka
Copy link
Member

Please add a NEWS entry.

Copy link
Contributor Author

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a NEWS entry and a test with an underscore only class name.

Lib/copyreg.py Outdated
@@ -128,7 +128,7 @@ class found there. (This assumes classes don't modify their
continue
# mangled names
elif name.startswith('__') and not name.endswith('__'):
names.append('_%s%s' % (c.__name__, name))
names.append('_%s%s' % (c.__name__.lstrip('_'), name))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, I wasn't aware of that case.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Please sign the PSF contributor agreement and add your name into Misc/ACKS.

@ShaneHarvey
Copy link
Contributor Author

Thanks for the review @serhiy-storchaka. I signed the PSF contributor agreement yesterday and my GitHub is linked to my bugs.python.org account. Does it take some time for @the-knights-who-say-ni to notice?

@serhiy-storchaka serhiy-storchaka added CLA signed type-bug An unexpected behavior, bug, or error and removed CLA not signed labels Aug 4, 2017
@serhiy-storchaka
Copy link
Member

Usually it takes a one working day (as in this case).

@serhiy-storchaka serhiy-storchaka merged commit c4c9866 into python:master Aug 4, 2017
@serhiy-storchaka
Copy link
Member

Thank you for your contribution @ShaneHarvey! Do you mind to backport these changes to 3.6 and 2.7?

@ShaneHarvey
Copy link
Contributor Author

Sure I can backport it to those branches.

ShaneHarvey added a commit to ShaneHarvey/cpython that referenced this pull request Aug 4, 2017
ShaneHarvey added a commit to ShaneHarvey/cpython that referenced this pull request Aug 4, 2017
@bedevere-bot
Copy link

GH-3003 is a backport of this pull request to the 3.6 branch.

@bedevere-bot
Copy link

GH-3004 is a backport of this pull request to the 2.7 branch.

serhiy-storchaka pushed a commit that referenced this pull request Aug 5, 2017
serhiy-storchaka pushed a commit that referenced this pull request Aug 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants