-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-138349: Fix crash when combining module-level annotation and listcomp #138363
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
Conversation
Do you need to bump the pyc magic number as well? I forgot whether bytecode invalidation matters here. |
The changes look correct to me, but I've not looked that closely at the conditional annotation code. |
@JelleZijlstra: Can you update the magic number (in |
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The changes does fix the crash and the added tests check for non-regression.
Thanks @JelleZijlstra for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, @JelleZijlstra and @vstinner, I could not cleanly backport this to
|
… listcomp (python#138363) (cherry picked from commit 7a6fd4a)
GH-138749 is a backport of this pull request to the 3.14 branch. |
Merged, thanks @JelleZijlstra. I wrote a backport to 3.14 (I adapted the magic number for 3.14). |
The bug was that we used the wrong name list to get
__conditional_annotations__
, which caused us to emit a SET_ADD that was adding to something that wasn't a set. This manifested as a hang on debug builds and a crash on release builds for whatever reason, but the issue became more apparent when I added an assertion tosetobject.c
to make sure we were only adding to sets.