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
I am using v0.910 and suddenly for my local changes to our project mypy fails with a crash report.
Traceback
I followed the guide to run mypy from source after I saw the crash. So this traceback is with mypy-0.920+dev.3dcccf221ead4b3143208fc2a1631336d6186e4
/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/typeshed/stdlib/_typeshed/__init__.pyi:62: 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:/python/mypy/issues
version: 0.920+dev.3dcccf221ead4b3143208fc2a1631336d6186e45
Dropping into pdb
[14] > /home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal.py(4293)lookup_fully_qualified()
-> return n.names[parts[-1]]
(Pdb++) c
Traceback (most recent call last):
File "/home/lefteris/.virtualenvs/rotkipy37/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/__main__.py", line 11, in console_entry
main(None, sys.stdout, sys.stderr)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/main.py", line 87, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/main.py", line 165, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/build.py", line 180, in build
sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/build.py", line 254, in _build
graph = dispatch(sources, manager, stdout)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/build.py", line 2697, in dispatch
process_graph(graph, manager)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/build.py", line 3021, in process_graph
process_stale_scc(graph, scc, manager)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/build.py", line 3113, in process_stale_scc
mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal_main.py", line 78, in semantic_analysis_for_scc
process_top_levels(graph, scc, patches)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal_main.py", line 203, in process_top_levels
patches)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal_main.py", line 331, in semantic_analyze_target
active_type=active_type)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal.py", line 398, in refresh_partial
self.refresh_top_level(node)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal.py", line 409, in refresh_top_level
self.accept(d)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal.py", line 4894, in accept
node.accept(self)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/nodes.py", line 1075, in accept
return visitor.visit_assignment_stmt(self)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal.py", line 1998, in visit_assignment_stmt
if self.check_and_set_up_type_alias(s):
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal.py", line 2584, in check_and_set_up_type_alias
self.analyze_alias(rvalue, allow_placeholder=True)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal.py", line 2504, in analyze_alias
global_scope=global_scope)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/typeanal.py", line 92, in analyze_type_alias
res = type.accept(analyzer)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/types.py", line 503, in accept
return visitor.visit_unbound_type(self)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/typeanal.py", line 163, in visit_unbound_type
typ = self.visit_unbound_type_nonoptional(t, defining_literal)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/typeanal.py", line 227, in visit_unbound_type_nonoptional
special = self.try_analyze_special_unbound_type(t, fullname)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/typeanal.py", line 344, in try_analyze_special_unbound_type
return self.analyze_literal_type(t)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/typeanal.py", line 800, in analyze_literal_type
analyzed_types = self.analyze_literal_param(i + 1, arg, t)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/typeanal.py", line 860, in analyze_literal_param
fallback = self.named_type_with_normalized_str(arg.base_type_name)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/typeanal.py", line 995, in named_type_with_normalized_str
return self.named_type(fully_qualified_name)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/typeanal.py", line 1001, in named_type
node = self.lookup_fqn_func(fully_qualified_name)
File "/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/semanal.py", line 4293, in lookup_fully_qualified
return n.names[parts[-1]]
KeyError: 'str'
/home/lefteris/.virtualenvs/rotkipy37/lib/python3.7/site-packages/mypy/typeshed/stdlib/_typeshed/__init__.pyi:62: : note: use --pdb to drop into pdb
To Reproduce
I opened a PR with my changes that reproduced the problem here: rotki/rotki#3124. It's a work in progress as far as the actual change in our project is concerned but the crash is reproducible there. Commit with hash f088361 should be used.
I don't know much about the mypy core code but poking around with pdb it seems that the builtins do not contain str in a mapping while it contains a lot of other primitives.
This lead me to think that perhaps the name of the file typing.py could cause a problem since it's the same as the typing module and indeed voila. If I change the name to typorz.py the error is no longer happening. Also if I keep it typing.py and move it somewhere else and not under websockets directory then again the error is no longer happening.
I don't know exactly what this means for how it's handled in the code but hope this is enough of a hint to guide you guys in the right direction.
Crash Report
I am using v0.910 and suddenly for my local changes to our project mypy fails with a crash report.
Traceback
I followed the guide to run mypy from source after I saw the crash. So this traceback is with
mypy-0.920+dev.3dcccf221ead4b3143208fc2a1631336d6186e4
To Reproduce
I opened a PR with my changes that reproduced the problem here: rotki/rotki#3124. It's a work in progress as far as the actual change in our project is concerned but the crash is reproducible there. Commit with hash
f088361
should be used.This is how we run mypy in our project:
This will eventually lead to the crash.
But I find mypy fascinating and experimented a bit more to see if I could narrow it down, and I did narrow it down to this file:
The file is super simple.
I don't know much about the mypy core code but poking around with pdb it seems that the builtins do not contain
str
in a mapping while it contains a lot of other primitives.This lead me to think that perhaps the name of the file
typing.py
could cause a problem since it's the same as the typing module and indeed voila. If I change the name totyporz.py
the error is no longer happening. Also if I keep ittyping.py
and move it somewhere else and not underwebsockets
directory then again the error is no longer happening.I don't know exactly what this means for how it's handled in the code but hope this is enough of a hint to guide you guys in the right direction.
Your Environment
mypy rotkehlchen/api/websockets/typing.py --install-types --show-traceback --pdb
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: