Traceback (most recent call last):
File "test.py", line 4, in <module>
import_module('A')
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "/home/jolaf/.local/lib/python3.10/site-packages/typeguard/_importhook.py", line 98, in exec_module
super().exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "A.py", line 2, in <module>
class A(IntEnum):
File "/usr/lib/python3.10/enum.py", line 289, in __new__
enum_member = __new__(enum_class, *args)
File "A.py", line 3, in __new__
def __new__(cls, value: int, phrase: str = "") -> "A":
NameError: name 'A' is not defined
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.1.3
Python version
3.10.12
What happened?
How can we reproduce the bug?
test.py:A.py: