Skip to content

"AssertionError: Should never get here in normal mode" when using --follow-imports silent #5377

Closed
@petergaultney

Description

@petergaultney
  • What is the actual behavior/output?
    AssertionError on running mypy test.py --follow-imports silent --disallow-untyped-defs
  • What is the behavior/output you expect?
    No AssertionError
  • What are the versions of mypy and Python you are using?
    .610, Python 3.6.5 from anaconda
    Do you see the same issue after installing mypy from Git master?
    Haven't tried this.
  • What are the mypy flags you are using? (For example --strict-optional)
    --follow-imports silent --disallow-untyped-defs (it doesn't seem to happen if I remove --follow-imports silent)
  • If mypy crashed with a traceback, please paste
    the full traceback below.
Traceback (most recent call last):
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/bin/mypy", line 11, in <module>
    sys.exit(console_entry())
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
    main(None)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/main.py", line 91, in main
    res = type_check_only(sources, bin_dir, options, flush_errors, fscache)  # noqa
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/main.py", line 148, in type_check_only
    fscache=fscache)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/build.py", line 185, in build
    flush_errors, fscache)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/build.py", line 285, in _build
    graph = dispatch(sources, manager)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/build.py", line 2398, in dispatch
    process_graph(graph, manager)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/build.py", line 2684, in process_graph
    process_fresh_modules(graph, prev_scc, manager)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/build.py", line 2770, in process_fresh_modules
    graph[id].fix_cross_refs()
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/build.py", line 1853, in fix_cross_refs
    self.options.use_fine_grained_cache)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/fixup.py", line 25, in fixup_module
    node_fixer.visit_symbol_table(tree.names)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/fixup.py", line 95, in visit_symbol_table
    self.visit_type_info(value.node)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/fixup.py", line 48, in visit_type_info
    base.accept(self.type_fixer)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/types.py", line 512, in accept
    return visitor.visit_instance(self)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/fixup.py", line 156, in visit_instance
    inst.type = lookup_qualified_typeinfo(self.modules, type_ref, self.quick_and_dirty)
  File "/Users/peter/sw/anaconda3/envs/pycharm_me/lib/python3.6/site-packages/mypy/fixup.py", line 246, in lookup_qualified_typeinfo
    assert quick_and_dirty, "Should never get here in normal mode"
AssertionError: Should never get here in normal mode

This seems to happen when I make a change to add a new error (e.g. missing type in function def) where there wasn't one before.
This doesn't seem to happen if I'm not importing botocore.vendored requests. But it also does not need to be used in the same function that has the new error.
I can work around it by blowing away the .mypy_cache directory. But future changes to test.py just make the error come back again.

I think it's likely related to botocore in some way, but obviously the assertion is mypy's fault.

mypy-610-assertion.zip

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions