Closed
Description
Crash Report
It seems that mypy doesn't like from x import y
statements inside classes. While maybe unusual, from dataclasses import replace
is quite handy.
Traceback
Running as mypy --show-traceback a.py
, on commit 8e909e4.
a.py:4: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.812
Traceback (most recent call last):
File "mypy/checkexpr.py", line 3898, in accept
File "mypy/nodes.py", line 1507, in accept
File "mypy/checkexpr.py", line 2025, in visit_member_expr
File "mypy/checkexpr.py", line 2043, in analyze_ordinary_member_access
File "mypy/checkmember.py", line 126, in analyze_member_access
File "mypy/checkmember.py", line 143, in _analyze_member_access
File "mypy/checkmember.py", line 219, in analyze_instance_member_access
File "mypy/maptype.py", line 20, in map_instance_to_supertype
AttributeError: attribute 'type_vars' of 'TypeInfo' undefined
a.py:4: : note: use --pdb to drop into pdb
To Reproduce
a.py
:
class A:
from b import foo
print(A().foo()) # ← INTERNAL ERROR here
b.py
:
def foo(self):
return ""
Your Environment
- Mypy version used: 8e909e4
- Mypy command-line flags:
mypy --show-traceback a.py
- Mypy configuration options from
mypy.ini
(and other config files): None - Python version used: 3.9.5
- Operating system and version: Arch