-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
affects-typeshedAnything that blocks a typeshed changeAnything that blocks a typeshed changecrashsemantic-analyzerProblems that happen during semantic analysisProblems that happen during semantic analysistopic-pep-585PEP 585 (builtin generics)PEP 585 (builtin generics)
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
SequenceandMutableSequenceintypeshed/stdlib/builtins.pyiso that they are imported fromcollections.abcrather 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
Sequencefromcollections.abc; importing justMutableSequencefromcollections.abc; and importing bothSequenceandMutableSequencefromcollections.abc.
Mypy version used
0.930
Metadata
Metadata
Assignees
Labels
affects-typeshedAnything that blocks a typeshed changeAnything that blocks a typeshed changecrashsemantic-analyzerProblems that happen during semantic analysisProblems that happen during semantic analysistopic-pep-585PEP 585 (builtin generics)PEP 585 (builtin generics)