🐛 Bug Report
I am getting frequently the below error while running mypy
pagination.py:187: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 0.782
C:\GitRepo\KenshoServices\projects\external-search\app\caching\pagination.py:187: : note: please use --show-traceback to print a traceback when reporting a bug
To Reproduce
mypy --config-file=setup.cfg $APP_DIR
Expected Behavior
There should not be any errors.
Your Environment
-
Mypy version used: 0.782
-
Mypy command-line flags:
-
Mypy configuration options from mypy.ini (and other config files): setup.cfg
[mypy]
ignore_missing_imports = true
follow_imports = skip
disallow_untyped_calls = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
strict_optional = true
-
Python version used: 3.6
-
Operating system and version: gitbash in windows7
Please give the output by running with the --show-traceback flag as the error indicates.
Closing for a lack of details
Here's what I'm seeing:
george@suse-12_5 14:08 ~/src/test> mypy --show-traceback typing.py
/home/george/miniconda3/lib/python3.7/site-packages/mypy/typeshed/stdlib/2and3/_typeshed/init.pyi:58: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.790
Traceback (most recent call last):
File "/home/george/miniconda3/bin/mypy", line 10, in
sys.exit(console_entry())
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/main.py", line 8, in console_entry
main(None, sys.stdout, sys.stderr)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/main.py", line 90, in main
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/build.py", line 181, in build
sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/build.py", line 254, in _build
graph = dispatch(sources, manager, stdout)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/build.py", line 2630, in dispatch
process_graph(graph, manager)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/build.py", line 2953, in process_graph
process_stale_scc(graph, scc, manager)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/build.py", line 3045, in process_stale_scc
mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/semanal_main.py", line 78, in semantic_analysis_for_scc
process_top_levels(graph, scc, patches)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/semanal_main.py", line 203, in process_top_levels
patches)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/semanal_main.py", line 331, in semantic_analyze_target
active_type=active_type)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/semanal.py", line 357, in refresh_partial
self.refresh_top_level(node)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/semanal.py", line 368, in refresh_top_level
self.accept(d)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/semanal.py", line 4700, in accept
node.accept(self)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/nodes.py", line 1063, in accept
return visitor.visit_assignment_stmt(self)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/semanal.py", line 1918, in visit_assignment_stmt
if self.check_and_set_up_type_alias(s):
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/semanal.py", line 2479, in check_and_set_up_type_alias
self.analyze_alias(rvalue, allow_placeholder=True)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/semanal.py", line 2399, in analyze_alias
global_scope=global_scope)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/typeanal.py", line 91, in analyze_type_alias
res = type.accept(analyzer)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/types.py", line 451, in accept
return visitor.visit_unbound_type(self)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/typeanal.py", line 160, in visit_unbound_type
typ = self.visit_unbound_type_nonoptional(t, defining_literal)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/typeanal.py", line 211, in visit_unbound_type_nonoptional
special = self.try_analyze_special_unbound_type(t, fullname)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/typeanal.py", line 314, in try_analyze_special_unbound_type
return self.analyze_literal_type(t)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/typeanal.py", line 696, in analyze_literal_type
analyzed_types = self.analyze_literal_param(i + 1, arg, t)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/typeanal.py", line 709, in analyze_literal_param
fallback=self.named_type_with_normalized_str(arg.original_str_fallback),
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/typeanal.py", line 884, in named_type_with_normalized_str
return self.named_type(fully_qualified_name)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/typeanal.py", line 890, in named_type
node = self.lookup_fqn_func(fully_qualified_name)
File "/home/george/miniconda3/lib/python3.7/site-packages/mypy/semanal.py", line 4114, in lookup_fully_qualified
return n.names[parts[-1]]
KeyError: 'str'
/home/george/miniconda3/lib/python3.7/site-packages/mypy/typeshed/stdlib/2and3/_typeshed/init.pyi:58: : note: use --pdb to drop into pdb
You should probably give your file a different name than typing.py.
Oops -- learned about that a few months ago and completely forgot; thank you!