Things to check first
Typeguard version
4.0.0
Python version
3.11.0
What happened?
When using Dict[str, Any] as a return type of a class method, you get the following error:
Traceback (most recent call last):
File "/home/xyz/test.py", line 15, in <module>
A().foo()
File "/home/xyz/test.py", line 13, in foo
def foo(self) -> Dict[str, Any]:
^^^^^^^^
NameError: name 'Any_' is not defined. Did you mean: 'Any'?
This error does not occur in typeguard 3
How can we reproduce the bug?
from typeguard import typechecked
from typing import Any, Dict
# Works
@typechecked
def foo() -> Dict[str, Any]:
return {}
foo()
# Does not work
class A:
@typechecked
def foo(self) -> Dict[str, Any]:
return {}
A().foo()
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.0.0
Python version
3.11.0
What happened?
When using
Dict[str, Any]as a return type of a class method, you get the following error:This error does not occur in
typeguard3How can we reproduce the bug?