Closed
Description
Crash Report
After version 0.940, In #12023 and #12199, mypy
disabled class scoped import. But, I found in a decorated function it will still raise an INTERNAL ERROR
Traceback
(Insert traceback and other messages from mypy here -- use `--show-traceback`.)
$ mypy . --show-traceback
./a.py:4: 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: 0.942
Traceback (most recent call last):
File "mypy/checkexpr.py", line 3978, in accept
File "mypy/nodes.py", line 1670, in accept
File "mypy/checkexpr.py", line 2087, in visit_member_expr
File "mypy/checkexpr.py", line 2105, in analyze_ordinary_member_access
File "mypy/checkmember.py", line 130, in analyze_member_access
File "mypy/checkmember.py", line 147, in _analyze_member_access
File "mypy/checkmember.py", line 231, in analyze_instance_member_access
File "mypy/checkmember.py", line 385, in analyze_member_var_access
File "mypy/checkmember.py", line 559, in analyze_var
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
$ cat a.py
class A:
from b import foo
print(A().foo()) # ← INTERNAL ERROR here
$ cat b.py
def c(func):
return func
@c
def foo(self):
return ""
$ mypy .
./a.py:4: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 0.942
./a.py:4: : note: please use --show-traceback to print a traceback when reporting a bug
Your Environment
- Mypy version used: 0.942
- Mypy command-line flags: no flag
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used: 3.8.8
- Operating system and version: macOS 12.3