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
Bug report
Defining a subclass of TypedDict, or a class decorated with @dataclasses.dataclass, containing at least one field with an annotation that fulfills some conditions, causes problems.
After successfully compiling the module with the class definition, importing the compiled module and causing the class definition to load will raise KeyError: <name of type>.
For the type annotation to cause this error, it must:
access a class as an attribute of a module (e.g. using dot operator)
this module is defined in a package (a folder), may be the __init__.py module
the class definition is not inside the __init__.py of the package (alias is fine)
Bug report
Defining a subclass of
TypedDict
, or a class decorated with@dataclasses.dataclass
, containing at least one field with an annotation that fulfills some conditions, causes problems.After successfully compiling the module with the class definition, importing the compiled module and causing the class definition to load will raise
KeyError: <name of type>
.For the type annotation to cause this error, it must:
__init__.py
module__init__.py
of the package (alias is fine)Examples:
json.JSONDecoder
,json.decoder.JSONDecoder
,pygame.Surface
Related issue: #1075 (fixed for 1.14)
To reproduce
In
test.py
:Compile successfully:
Import, run compiled module
Version:
mypy 1.15.0 (compiled: yes)
The text was updated successfully, but these errors were encountered: