We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
KeyError 'expr'
Bug Report
(A clear and concise description of what the bug is.)
To Reproduce
import ast from typing import NamedTuple class C(NamedTuple): value: ast.expr
Expected Behavior
not crash
Actual Behavior
$ mypyc t.py running build_ext building 't' extension clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/private/tmp/z/venv/lib/python3.12/site-packages/mypyc/lib-rt -I/private/tmp/z/venv/include -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c build/__native.c -o build/temp.macosx-13-arm64-cpython-312/build/__native.o -O3 -g1 -Werror -Wno-unused-function -Wno-unused-label -Wno-unreachable-code -Wno-unused-variable -Wno-unused-command-line-argument -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-ignored-optimization-argument -Wno-cpp clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk build/temp.macosx-13-arm64-cpython-312/build/__native.o -o build/lib.macosx-13-arm64-cpython-312/t.cpython-312-darwin.so copying build/lib.macosx-13-arm64-cpython-312/t.cpython-312-darwin.so -> $ python3 -c 'import t' Traceback (most recent call last): File "<string>", line 1, in <module> File "t.py", line 5, in <module> value: ast.expr KeyError: 'expr'
Your Environment
mypy.ini
The text was updated successfully, but these errors were encountered:
One workaround is to use a from import:
from
from ast import expr from typing import NamedTuple class C(NamedTuple): value: expr
It appears you don't need this workaround if you define a plain class and not inherit from a typing.NamedTuple.
typing.NamedTuple
Sorry, something went wrong.
No branches or pull requests
Bug Report
(A clear and concise description of what the bug is.)
To Reproduce
Expected Behavior
not crash
Actual Behavior
Your Environment
mypy.ini
(and other config files): n/aThe text was updated successfully, but these errors were encountered: