Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-119311: Fix name mangling with PEP 695 generic classes#119464

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JelleZijlstra merged 5 commits intopython:mainfromJelleZijlstra:pep695-mangle2
May 28, 2024

Conversation

@JelleZijlstra
Copy link
Member

@JelleZijlstraJelleZijlstra commentedMay 23, 2024
edited by bedevere-appbot
Loading

Fixes#119311.Fixes#119395.

There are two related bugs with name mangling in generic classes: it incorrectly gets applied to names that appear in the class's type param scope (#119311) and it leaks into code after the generic class (#119395). This PR fixes both by introducing a new mechanism where in a type param scope, only type param names are mangled.

Unfortunately, I'm not sure we can backport this to 3.12, as it changes some internal C APIs and the magic number.

Copy link
Member

@carljmcarljm left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@carljm
Copy link
Member

I'm not sure I see why this can't be backported to 3.12.

I don't know if we usually bump bytecode magic number in patch releases, but surely that doesn't prevent us from backporting any compiler fixes at all. This change doesn't break execution of previously-compiled bytecode (any more than it was already buggy), so the worst case if backported without magic number bump is that some buggy bytecode wouldn't get the fix immediately. That's strictly better than nobody getting the fix at all in 3.12. (I'm not sure how else we can fix the issue of mangling type param names but not other names in class bases list.)

And I don't see where this changes existing C API. It adds a new function, but only internal/pycore. And it changes the symtable entry struct, but again that's not part of the public API.

@JelleZijlstraJelleZijlstra merged commita9a74da intopython:mainMay 28, 2024
@miss-islington-app
Copy link

Thanks@JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry,@JelleZijlstra, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker a9a74da4a0ca0645f049e67b6434a95e30592c32 3.13

@miss-islington-app
Copy link

Thanks@JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington-app
Copy link

Sorry,@JelleZijlstra, I could not cleanly backport this to3.12 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker a9a74da4a0ca0645f049e67b6434a95e30592c32 3.12

JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this pull requestMay 28, 2024
@bedevere-app
Copy link

GH-119643 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelMay 28, 2024
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this pull requestMay 28, 2024
@bedevere-app
Copy link

GH-119644 is a backport of this pull request to the3.12 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.12only security fixes labelMay 28, 2024
JelleZijlstra added a commit that referenced this pull requestMay 28, 2024
Yhg1s pushed a commit that referenced this pull requestJun 4, 2024
…9464) (#119644)* [3.12]gh-119311: Fix name mangling with PEP 695 generic classes (#119464)Fixes#119311.Fixes#119395.(cherry picked from commita9a74da)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@carljmcarljmcarljm approved these changes

@brettcannonbrettcannonAwaiting requested review from brettcannonbrettcannon is a code owner

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

@ncoghlanncoghlanAwaiting requested review from ncoghlanncoghlan is a code owner

@warsawwarsawAwaiting requested review from warsawwarsaw is a code owner

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

@iritkatrieliritkatrielAwaiting requested review from iritkatrieliritkatriel is a code owner

Assignees

@JelleZijlstraJelleZijlstra

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

PEP 695: Name mangling leaks to surrounding scope Unexpected name mangling behavior with generics

2 participants

@JelleZijlstra@carljm

[8]ページ先頭

©2009-2025 Movatter.jp