gh-119666: fix multiple class-scope comprehensions referencing __class__#120295
Merged
carljm merged 2 commits intopython:mainfrom Jun 10, 2024
Merged
gh-119666: fix multiple class-scope comprehensions referencing __class__#120295carljm merged 2 commits intopython:mainfrom
carljm merged 2 commits intopython:mainfrom
Conversation
Member
|
Is there any chance this also fixes #119233? |
Member
Author
Member
|
Fine with me. I think the test cases here probably cover both reproducers? |
Member
Author
|
Yeah, the essence of both reproducers is the same: >1 comprehension, in class scope, referencing |
alex
approved these changes
Jun 9, 2024
|
Thanks @carljm for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jun 10, 2024
…__class__ (pythonGH-120295) (cherry picked from commit 0ae8579) Co-authored-by: Carl Meyer <carl@oddbird.net>
|
GH-120299 is a backport of this pull request to the 3.13 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jun 10, 2024
…__class__ (pythonGH-120295) (cherry picked from commit 0ae8579) Co-authored-by: Carl Meyer <carl@oddbird.net>
|
GH-120300 is a backport of this pull request to the 3.12 branch. |
carljm
pushed a commit
that referenced
this pull request
Jun 10, 2024
carljm
pushed a commit
that referenced
this pull request
Jun 10, 2024
mrahtz
pushed a commit
to mrahtz/cpython
that referenced
this pull request
Jun 30, 2024
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this pull request
Jul 11, 2024
estyxx
pushed a commit
to estyxx/cpython
that referenced
this pull request
Jul 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It took a few months, but the fuzzer discovered that the fix in #115139 was not quite sufficient. It was only applied in the case where the
__class__symbol did not exist in the outer class scope, but it actually needs to be applied regardless.Verified that all listcomp tests (apart from
test_frame_locals, which is now intentionally diverging from pre-3.12 comprehension behavior, since the implementation of PEP 667) pass both with comprehension inlining enabled and disabled, so they reflect the same behavior as before Python 3.12.