Closed
Description
Crash Report
Mypy crashes if one or both of Sequence
and MutableSequence
is imported from collections.abc
instead of typing
in the typeshed stub for builtins
.
Traceback
stdlib\builtins.pyi:1506: error: Unexpected "..."
C:\Users\Alex\Desktop\Code dump\typeshed\stdlib\collections\__init__.pyi: 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.930
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\Alex\Desktop\Code dump\typeshed\.venv3\Scripts\mypy.exe\__main__.py", line 7, in <module>
sys.exit(console_entry())
File "mypy\build.py", line 1972, in wrap_context
File "mypy\semanal_main.py", line 326, in semantic_analyze_target
File "mypy\semanal.py", line 405, in refresh_partial
File "mypy\semanal.py", line 414, in refresh_top_level
File "mypy\semanal.py", line 444, in add_implicit_module_attrs
AssertionError:
C:\Users\Alex\Desktop\Code dump\typeshed\stdlib\collections\__init__.pyi: : note: use --pdb to drop into pdb
To Reproduce
- Clone typeshed
- Change one or both of
Sequence
andMutableSequence
intypeshed/stdlib/builtins.pyi
so that they are imported fromcollections.abc
rather thantyping
. - cd into the typeshed repo.
- Run
mypy stdlib/functools.py --show-traceback
(the file you run mypy on is irrelevant).
Using the typeshed CI, I have reproduced this issue:
- On MacOS, Windows and Ubuntu
- On Python versions 3.6-3.10 inclusive.
- Importing just
Sequence
fromcollections.abc
; importing justMutableSequence
fromcollections.abc
; and importing bothSequence
andMutableSequence
fromcollections.abc
.
Mypy version used
0.930