Repository navigation
Yet another "AssertionError: Should never get here in normal mode" #5631
Copy link
Copy link
Closed
Labels
Description
Similar crash as in #5192; happening with current pip master.
$ # In a venv with only mypy installed.
$ git clone https://github.com/pypa/pip.git --depth=1
[...]
$ cd pip
$ git fetch origin deeb1e493d8947a957c86bf256e7f5fa91c92e52
$ git checkout deeb1e493d8947a957c86bf256e7f5fa91c92e52
$ # Populate the cache; there's 2 errors as expected.
$ mypy src
[...]
$ # This run will crash
$ mypy src
Traceback (most recent call last):
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/main.py", line 91, in main
res = type_check_only(sources, bin_dir, options, flush_errors, fscache) # noqa
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/main.py", line 148, in type_check_only
fscache=fscache)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/build.py", line 183, in build
flush_errors, fscache)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/build.py", line 356, in _build
graph = dispatch(sources, manager)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/build.py", line 2543, in dispatch
process_graph(graph, manager)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/build.py", line 2833, in process_graph
process_fresh_modules(graph, prev_scc, manager)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/build.py", line 2919, in process_fresh_modules
graph[id].fix_cross_refs()
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/build.py", line 1927, in fix_cross_refs
self.options.use_fine_grained_cache)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/fixup.py", line 24, in fixup_module
node_fixer.visit_symbol_table(tree.names)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/fixup.py", line 89, in visit_symbol_table
value.node.accept(self)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/nodes.py", line 2582, in accept
return visitor.visit_type_alias(self)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/fixup.py", line 135, in visit_type_alias
a.target.accept(self.type_fixer)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/types.py", line 501, in accept
return visitor.visit_instance(self)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/fixup.py", line 149, in visit_instance
inst.type = lookup_qualified_typeinfo(self.modules, type_ref, self.quick_and_dirty)
File "/Users/pradyunsg/.virtualenvs/tmp-646a2fd8b91d920/lib/python3.7/site-packages/mypy/fixup.py", line 239, in lookup_qualified_typeinfo
assert quick_and_dirty, "Should never get here in normal mode"
AssertionError: Should never get here in normal modeI haven't tested with master (internet access is patchy for me atm) but this does occur for mypy 0.630 on Python 3.7.0.
Reactions are currently unavailable
Activity
pradyunsg commentedon Sep 18, 2018
Doing
rm -r .mypy_cache/3.7/pip/_vendor/before a second run prevents this crash.ilevkivskyi commentedon Sep 18, 2018
I still see the crash on master. I am investigating now.
ilevkivskyi commentedon Sep 18, 2018
OK, it looks like the code causing the crash is also similar to the previous one (now in
urllib3):I will try to write a simple repro now.
ilevkivskyi commentedon Sep 18, 2018
OK, the minimal repro is as simple as this:
Also it looks like this is a regression since 0.620, caused by #5565
The fix is straightforward, the only question is does this warrant a bug-fix release 0.631?
JukkaL commentedon Sep 18, 2018
Let's wait first if there are other reports of this issue. If not, we can release 0.640 in ~two weeks, on a slightly accelerated schedule. If there are other reports, a bug-fix release may make sense.
Don't crash on aliases like C = C (#5632)
pradyunsg commentedon Nov 10, 2018
Thanks for this fix! ^.^
(late post)