You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{'x': 1, 'y': 1}
Success: no issues found in 1 source file
0 errors, 0 warnings, 0 informations
Now add the @typechecked decorator, and run python bug.py again:
Traceback (most recent call last):
File "C:\Code\project\bug.py", line 22, in <module>
bug()
File "C:\Code\project\bug.py", line 18, in bug
args: Args = {"x": 1, "y": 1}
^^^^
NameError: name 'Args' is not defined. Did you mean: 'args'?
One workaround is to add bug2.py:
fromtypingimportTypedDictclassArgs(TypedDict):
x: inty: int
Things to check first
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
Typeguard version
4.2.1
Python version
3.12.3
What happened?
typechecked
code tries to use a class that is hidden behindTYPE_CHECKING
and should not be required at runtime.How can we reproduce the bug?
bug.py
python bug.py && mypy bug.py && pyright bug.py
Now add the
@typechecked
decorator, and runpython bug.py
again:One workaround is to add
bug2.py
:and modify
bug.py
toBut that feels kind of unnecessary, I think.
The text was updated successfully, but these errors were encountered: