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
Defining a function named __post_init__ anywhere that isn't a class base-level crashes mypy.
Traceback
lmao.py:1: 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.6.1
Traceback (most recent call last):
File "mypy/checker.py", line 585, in accept
File "mypy/nodes.py", line 790, in accept
File "mypy/checker.py", line 994, in visit_func_def
File "mypy/checker.py", line 998, in _visit_func_def
File "mypy/checker.py", line 1081, in check_func_item
File "mypy/plugins/dataclasses.py", line 1091, in is_processed_dataclass
AttributeError: attribute 'metadata' of 'TypeInfo' undefined
lmao.py:1: : note: use --pdb to drop into pdb
To Reproduce
Top-level:
def__post_init__(): ...
Nested:
classFoo:
deffunc(self):
def__post_init__(): ...
The following does not cause mypy to crash:
__post_init__=lambda_: ...
Nor does
classFoo:
def__post_init__(): ...
Your Environment
mypy version used: 1.61
Python version used: Reproduced on 3.9 and 3.11
Operating system and version: macOS Sonoma 14.1
The text was updated successfully, but these errors were encountered:
This reproduces with mypy 1.6.1, but is already fixed on the mypy master branch. The fix will be included with mypy 1.7, which should be released soon (see #16341)
Crash Report
Defining a function named
__post_init__
anywhere that isn't a class base-level crashes mypy.Traceback
To Reproduce
Top-level:
Nested:
The following does not cause mypy to crash:
Nor does
Your Environment
The text was updated successfully, but these errors were encountered: