FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-119666: fix multiple class-scope comprehensions referencing __class__ by carljm · Pull Request #120295 · python/cpython · GitHub

/ cpython Public

gh-119666: fix multiple class-scope comprehensions referencing __class__ - #120295

Merged
carljm merged 2 commits into
python:mainfrom
carljm:classcell
Jun 10, 2024
Merged

carljm merged 2 commits into
python:mainfrom
carljm:classcell

Conversation

carljm commented Jun 9, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

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.

alex commented Jun 9, 2024

Copy link
Copy Markdown
Member

Is there any chance this also fixes #119233?

carljm commented Jun 9, 2024

Copy link
Copy Markdown
Member Author

Is there any chance this also fixes #119233?

Yes, just confirmed that it does. Ok if I close that as duplicate of #119666?

alex commented Jun 9, 2024

Copy link
Copy Markdown
Member

Fine with me. I think the test cases here probably cover both reproducers?

carljm commented Jun 9, 2024

Copy link
Copy Markdown
Member Author

Yeah, the essence of both reproducers is the same: >1 comprehension, in class scope, referencing super or __class__.

carljm merged commit 0ae8579 into python:main Jun 10, 2024

Copy link
Copy Markdown

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

carljm deleted the classcell branch June 10, 2024 02:23
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>

bedevere-app Bot commented Jun 10, 2024

Copy link
Copy Markdown

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>
bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jun 10, 2024

bedevere-app Bot commented Jun 10, 2024

Copy link
Copy Markdown

GH-120300 is a backport of this pull request to the 3.12 branch.

bedevere-app Bot removed the needs backport to 3.12 only security fixes label 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL