Closed
Description
Crash Report
When I code with def __post_init__()
, mypy reports INTERNAL ERROR.
To Reproduce
Here is a minimal code snippet to reproduce the crash:
def __post_init__(self):
self._a = a
Print the code in the file.py
and execute mypy file.py
.
Traceback
file.py:2: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.5.1
Traceback (most recent call last):
File "mypy/checker.py", line 584, in accept
File "mypy/nodes.py", line 788, in accept
File "mypy/checker.py", line 969, in visit_func_def
File "mypy/checker.py", line 973, in _visit_func_def
File "mypy/checker.py", line 1056, in check_func_item
File "mypy/plugins/dataclasses.py", line 1092, in is_processed_dataclass
AttributeError: attribute 'metadata' of 'TypeInfo' undefined
file.py:2: : note: use --pdb to drop into pdb
Your Environment
- Mypy version used:1.5.1
- Mypy command-line flags: mypy file.py --show-traceback
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used: 3.9.0
- Operating system and version: Ubuntu 20.04.6 LTS