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 trying to dig deeper on #5914, I ran into an internal error in mypy.
I ran mypy on this code, without any arguments other than the file name:
classOuter:
classInner:
passreveal_locals()
This is the traceback: (paths shortened)
Traceback (most recent call last):
File ".../bin/mypy", line 11, in <module>
sys.exit(console_entry())
File ".../lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File ".../lib/python3.6/site-packages/mypy/main.py", line 92, in main
res = build.build(sources, options, None, flush_errors, fscache)
File ".../lib/python3.6/site-packages/mypy/build.py", line 155, in build
result = _build(sources, options, alt_lib_path, flush_errors, fscache)
File ".../lib/python3.6/site-packages/mypy/build.py", line 204, in _build
graph = dispatch(sources, manager)
File ".../lib/python3.6/site-packages/mypy/build.py", line 2172, in dispatch
process_graph(graph, manager)
File ".../lib/python3.6/site-packages/mypy/build.py", line 2469, in process_graph
process_stale_scc(graph, scc, manager)
File ".../lib/python3.6/site-packages/mypy/build.py", line 2592, in process_stale_scc
graph[id].type_check_first_pass()
File ".../lib/python3.6/site-packages/mypy/build.py", line 1730, in type_check_first_pass
self.type_checker().check_first_pass()
File ".../lib/python3.6/site-packages/mypy/checker.py", line 282, in check_first_pass
self.accept(d)
File ".../lib/python3.6/site-packages/mypy/checker.py", line 393, in accept
stmt.accept(self)
File ".../lib/python3.6/site-packages/mypy/nodes.py", line 845, in accept
return visitor.visit_class_def(self)
File ".../lib/python3.6/site-packages/mypy/checker.py", line 1536, in visit_class_def
self.accept(defn.defs)
File ".../lib/python3.6/site-packages/mypy/checker.py", line 393, in accept
stmt.accept(self)
File ".../lib/python3.6/site-packages/mypy/nodes.py", line 910, in accept
return visitor.visit_block(self)
File ".../lib/python3.6/site-packages/mypy/checker.py", line 1688, in visit_block
self.accept(s)
File ".../lib/python3.6/site-packages/mypy/checker.py", line 393, in accept
stmt.accept(self)
File ".../lib/python3.6/site-packages/mypy/nodes.py", line 925, in accept
return visitor.visit_expression_stmt(self)
File ".../lib/python3.6/site-packages/mypy/checker.py", line 2602, in visit_expression_stmt
self.expr_checker.accept(s.expr, allow_none_return=True, always_allow_any=True)
File ".../lib/python3.6/site-packages/mypy/checkexpr.py", line 3003, in accept
typ = self.visit_call_expr(node, allow_none_return=True)
File ".../lib/python3.6/site-packages/mypy/checkexpr.py", line 228, in visit_call_expr
return self.accept(e.analyzed, self.type_context[-1])
File ".../lib/python3.6/site-packages/mypy/checkexpr.py", line 3007, in accept
typ = node.accept(self)
File ".../lib/python3.6/site-packages/mypy/nodes.py", line 1674, in accept
return visitor.visit_reveal_expr(self)
File ".../lib/python3.6/site-packages/mypy/checkexpr.py", line 2362, in visit_reveal_expr
} if expr.local_nodes is not None else {}
File ".../lib/python3.6/site-packages/mypy/checkexpr.py", line 2361, in <dictcomp>
var_node.name(): var_node.type for var_node in expr.local_nodes
AttributeError: 'TypeInfo' object has no attribute 'type'
I'm using mypy 0.641 on Python 3.6.5.
The text was updated successfully, but these errors were encountered:
The root cause were some improper casts when creating the `local_nodes` list. These were easy to fix by adding `isinstance(node, Var)` checks to the list comprehensions.
Fixes#5915
While trying to dig deeper on #5914, I ran into an internal error in mypy.
I ran mypy on this code, without any arguments other than the file name:
This is the traceback: (paths shortened)
I'm using mypy 0.641 on Python 3.6.5.
The text was updated successfully, but these errors were encountered: