You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first run of mypy reports an error normally. The second run crashes with AssertionError: Should never get here in normal mode. Clearing the cache with rm -rf .mypy_cache prevents the crash in the next run but keeps crashing in the runs after.
Full reproducer below.
Traceback
$ mypy --ignore-missing-imports t/
Traceback (most recent call last):
File "/tmp/venv/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/tmp/venv/lib/python3.10/site-packages/mypy/__main__.py", line 15, in console_entry
main()
File "/tmp/venv/lib/python3.10/site-packages/mypy/main.py", line 95, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/tmp/venv/lib/python3.10/site-packages/mypy/main.py", line 174, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 194, in build
result = _build(
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 277, in _build
graph = dispatch(sources, manager, stdout)
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 2914, in dispatch
process_graph(graph, manager)
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 3304, in process_graph
process_fresh_modules(graph, prev_scc, manager)
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 3385, in process_fresh_modules
graph[id].fix_cross_refs()
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 2120, in fix_cross_refs
fixup_module(self.tree, self.manager.modules, self.options.use_fine_grained_cache)
File "/tmp/venv/lib/python3.10/site-packages/mypy/fixup.py", line 53, in fixup_module
node_fixer.visit_symbol_table(tree.names, tree.fullname)
File "/tmp/venv/lib/python3.10/site-packages/mypy/fixup.py", line 125, in visit_symbol_table
self.visit_type_info(value.node)
File "/tmp/venv/lib/python3.10/site-packages/mypy/fixup.py", line 87, in visit_type_info
info.declared_metaclass.accept(self.type_fixer)
File "/tmp/venv/lib/python3.10/site-packages/mypy/types.py", line 1316, in accept
return visitor.visit_instance(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/fixup.py", line 198, in visit_instance
inst.type = lookup_fully_qualified_typeinfo(
File "/tmp/venv/lib/python3.10/site-packages/mypy/fixup.py", line 339, in lookup_fully_qualified_typeinfo
assert (
AssertionError: Should never get here in normal mode, got Var:t.types.Meta instead of TypeInfo
Fixes#14254
This essentially re-implements #13605
in a simpler way that also works in incremental mode. Also I decided to
set `meta_fallback_to_any` in case of errors, to match how we do this
for base classes.
Crash Report
The first run of mypy reports an error normally. The second run crashes with
AssertionError: Should never get here in normal mode
. Clearing the cache withrm -rf .mypy_cache
prevents the crash in the next run but keeps crashing in the runs after.Full reproducer below.
Traceback
To Reproduce
Create the following project structure:
Run
mypy --ignore-missing-imports t/
more than one time without deleting the.mypy_cache
folder.Your Environment
mypy 1.0.0+dev.734a0b96b79f20b3290ca5fee97c749ccb2e308f (compiled: no)
--ignore-missing-imports
mypy.ini
(and other config files): NonePython 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0]
Ubuntu 22.04.1 LTS on Windows 10 x86_64
5.15.74.2-microsoft-standard-WSL2
The text was updated successfully, but these errors were encountered: