Closed as not planned
Description
Crash Report
I was putting type hint to a decorator like so (P is a ParamSpec and T is a TypeVar)
from my_typing import Callable, Iterator, P, T, PathType
def chdir_decorator(folder:PathType) -> Callable[[Callable[P, T]], Callable[P, T]]:
def decorator(func:Callable[P,T]) -> Callable[P,T]:
@wraps(func)
def wrapper(*args:P.args,**kwarg:P.kwargs) -> T:
with chdir(folder):
return func(*args,**kwarg)
return wrapper
return decorator
and I got this error
Traceback (most recent call last):
File "C:\Python3.10.5\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python3.10.5\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Python3.10.5\Scripts\mypy.exe\__main__.py", line 7, in <module>
File "C:\Python3.10.5\lib\site-packages\mypy\__main__.py", line 12, in console_entry
main(None, sys.stdout, sys.stderr)
File "mypy\main.py", line 96, in main
File "mypy\main.py", line 173, in run_build
File "mypy\build.py", line 154, in build
File "mypy\build.py", line 230, in _build
File "mypy\build.py", line 2729, in dispatch
File "mypy\build.py", line 3087, in process_graph
File "mypy\build.py", line 3205, in process_stale_scc
File "mypy\build.py", line 2313, in write_cache
File "mypy\build.py", line 1470, in write_cache
File "mypy\nodes.py", line 352, in serialize
File "mypy\nodes.py", line 3435, in serialize
File "mypy\nodes.py", line 3372, in serialize
File "mypy\nodes.py", line 761, in serialize
File "mypy\types.py", line 1797, in serialize
File "mypy\types.py", line 1801, in serialize
File "mypy\types.py", line 647, in serialize
File "mypy\types.py", line 1190, in serialize
File "mypy\nodes.py", line 2742, in fullname
AttributeError: attribute 'TypeInfo' of '_fullname' undefined
(Insert traceback and other messages from mypy here -- use `--show-traceback`.)
To Reproduce
I included the full files decorated.zip (my_typing.py and my_module.py) because if I try to reduce to it more simple version or put everything in same file the problem disappear so maybe is some weird interaction there with my_typing...
my_typing use the following other modules numerary 0.4.2 and typing extensions 4.3.0.
I have been using my_typing without any issue thus far.
Of notice is that if I remove the return type hint from chdir_decorator it passes the the mypy check but with it crash for no apparent reason.
Your Environment
- Mypy version used: mypy 0.961 (compiled: yes)
- Mypy command-line flags: mypy my_module.py
- Mypy configuration options from
mypy.ini
(and other config files): None - Python version used: Python 3.10.5
- Operating system and version: windows 10