-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Annotated assignment in a match
block does not generate SETUP_ANNOTATIONS
#105164
Comments
FWIW, it's a runtime error when the module is imported, not run as main: $ cat lib.py
match 0:
case 0:
x: int = 1
$ cat main.py
import lib
$ python main.py
Traceback (most recent call last):
File "main.py", line 1, in <module>
import lib
File "lib.py", line 3, in <module>
x: int = 1
NameError: name '__annotations__' is not defined |
I think Looks like @JelleZijlstra picked this up already. Feel free to ping me for review! |
match
block does not generate SETUP_ANNOTATIONS
JelleZijlstra
added a commit
to JelleZijlstra/cpython
that referenced
this issue
Jun 1, 2023
JelleZijlstra
added a commit
that referenced
this issue
Jun 5, 2023
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jun 5, 2023
) (cherry picked from commit 69d1245) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
JelleZijlstra
added a commit
to JelleZijlstra/cpython
that referenced
this issue
Jun 5, 2023
…nGH-105177). (cherry picked from commit 69d1245) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
JelleZijlstra
added a commit
that referenced
this issue
Jun 5, 2023
JelleZijlstra
added a commit
that referenced
this issue
Jun 5, 2023
Thanks, looks like this is fixed |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Bug report
Compiling the following code:
generates
There is no
SETUP_ANNOTATIONS
opcode generated despite the__annotations__
access later on. (Found via google/pytype#1435 - for some reason this does not generate a runtime error, but it does cause issues for tools like pytype.)Your environment
cpython 3.10
Linked PRs
The text was updated successfully, but these errors were encountered: