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
While thinking about #2535 I realized there's a similar case not involving NamedTuple (nor TypedDict):
main.py:
importcrashblah# anything that triggers an error
crash.py:
classC:
deff(self) ->None:
classA:
passself.a=A()
This triggers a very similar crash in fixup.py when running mypy -i main.pyTWICE (from a cold cache):
$ rm -rf .mypy_cache/
$ mypy -i main.py
main.py:1: error: Name 'blah' is not defined
$ mypy -i main.py
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/guido/src/mypy/mypy/__main__.py", line 5, in <module>
main(None)
File "/Users/guido/src/mypy/mypy/main.py", line 41, in main
res = type_check_only(sources, bin_dir, options)
File "/Users/guido/src/mypy/mypy/main.py", line 86, in type_check_only
options=options)
File "/Users/guido/src/mypy/mypy/build.py", line 183, in build
dispatch(sources, manager)
File "/Users/guido/src/mypy/mypy/build.py", line 1524, in dispatch
process_graph(graph, manager)
File "/Users/guido/src/mypy/mypy/build.py", line 1753, in process_graph
process_fresh_scc(graph, prev_scc)
File "/Users/guido/src/mypy/mypy/build.py", line 1822, in process_fresh_scc
graph[id].fix_cross_refs()
File "/Users/guido/src/mypy/mypy/build.py", line 1307, in fix_cross_refs
fixup_module_pass_one(self.tree, self.manager.modules)
File "/Users/guido/src/mypy/mypy/fixup.py", line 21, in fixup_module_pass_one
node_fixer.visit_symbol_table(tree.names)
File "/Users/guido/src/mypy/mypy/fixup.py", line 86, in visit_symbol_table
self.visit_type_info(value.node)
File "/Users/guido/src/mypy/mypy/fixup.py", line 55, in visit_type_info
self.visit_symbol_table(info.names)
File "/Users/guido/src/mypy/mypy/fixup.py", line 88, in visit_symbol_table
value.node.accept(self)
File "/Users/guido/src/mypy/mypy/nodes.py", line 658, in accept
return visitor.visit_var(self)
File "/Users/guido/src/mypy/mypy/fixup.py", line 131, in visit_var
v.type.accept(self.type_fixer)
File "/Users/guido/src/mypy/mypy/types.py", line 433, in accept
return visitor.visit_instance(self)
File "/Users/guido/src/mypy/mypy/fixup.py", line 144, in visit_instance
node = lookup_qualified(self.modules, type_ref)
File "/Users/guido/src/mypy/mypy/fixup.py", line 234, in lookup_qualified
stnode = lookup_qualified_stnode(modules, name)
File "/Users/guido/src/mypy/mypy/fixup.py", line 245, in lookup_qualified_stnode
assert '.' in head, "Cannot find %s" % (name,)
AssertionError: Cannot find A
The text was updated successfully, but these errors were encountered:
Fixes#2559
The idea is the same as in PR #2553. The only difference is that mangled names are always stored in globals, otherwise there would be a problem for a method in a nested class that is itself inside a method.
Uh oh!
There was an error while loading. Please reload this page.
While thinking about #2535 I realized there's a similar case not involving NamedTuple (nor TypedDict):
This triggers a very similar crash in fixup.py when running
mypy -i main.py
TWICE (from a cold cache):The text was updated successfully, but these errors were encountered: