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
$ mypy mypy_break.py --show-traceback
mypy_break.py:7: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.650+dev.0b61e5476520c6e2b8d0136fab645cb3414e412f
Traceback (most recent call last):
File "/usr/local/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/usr/local/lib/python3.7/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/usr/local/lib/python3.7/site-packages/mypy/main.py", line 92, in main
res = build.build(sources, options, None, flush_errors, fscache)
File "/usr/local/lib/python3.7/site-packages/mypy/build.py", line 155, in build
result = _build(sources, options, alt_lib_path, flush_errors, fscache)
File "/usr/local/lib/python3.7/site-packages/mypy/build.py", line 204, in _build
graph = dispatch(sources, manager)
File "/usr/local/lib/python3.7/site-packages/mypy/build.py", line 2172, in dispatch
process_graph(graph, manager)
File "/usr/local/lib/python3.7/site-packages/mypy/build.py", line 2469, in process_graph
process_stale_scc(graph, scc, manager)
File "/usr/local/lib/python3.7/site-packages/mypy/build.py", line 2592, in process_stale_scc
graph[id].type_check_first_pass()
File "/usr/local/lib/python3.7/site-packages/mypy/build.py", line 1730, in type_check_first_pass
self.type_checker().check_first_pass()
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 282, in check_first_pass
self.accept(d)
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 393, in accept
stmt.accept(self)
File "/usr/local/lib/python3.7/site-packages/mypy/nodes.py", line 845, in accept
return visitor.visit_class_def(self)
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 1536, in visit_class_def
self.accept(defn.defs)
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 393, in accept
stmt.accept(self)
File "/usr/local/lib/python3.7/site-packages/mypy/nodes.py", line 910, in accept
return visitor.visit_block(self)
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 1688, in visit_block
self.accept(s)
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 393, in accept
stmt.accept(self)
File "/usr/local/lib/python3.7/site-packages/mypy/nodes.py", line 608, in accept
return visitor.visit_func_def(self)
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 704, in visit_func_def
self._visit_func_def(defn)
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 708, in _visit_func_def
self.check_func_item(defn, name=defn.name())
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 770, in check_func_item
self.check_func_def(defn, typ, name)
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 787, in check_func_def
for item, typ in self.expand_typevars(defn, typ):
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 1280, in expand_typevars
result.append((expand_func(defn, mapping), expanded))
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 3931, in expand_func
ret = defn.accept(visitor)
File "/usr/local/lib/python3.7/site-packages/mypy/nodes.py", line 608, in accept
return visitor.visit_func_def(self)
File "/usr/local/lib/python3.7/site-packages/mypy/treetransform.py", line 106, in visit_func_def
[self.copy_argument(arg) for arg in node.arguments],
File "/usr/local/lib/python3.7/site-packages/mypy/treetransform.py", line 106, in <listcomp>
[self.copy_argument(arg) for arg in node.arguments],
File "/usr/local/lib/python3.7/site-packages/mypy/treetransform.py", line 80, in copy_argument
self.visit_var(argument.variable),
File "/usr/local/lib/python3.7/site-packages/mypy/treetransform.py", line 199, in visit_var
new = Var(node.name(), self.optional_type(node.type))
File "/usr/local/lib/python3.7/site-packages/mypy/treetransform.py", line 584, in optional_type
return self.type(type)
File "/usr/local/lib/python3.7/site-packages/mypy/checker.py", line 3942, in type
return expand_type(type, self.map)
File "/usr/local/lib/python3.7/site-packages/mypy/expandtype.py", line 16, in expand_type
return typ.accept(ExpandTypeVisitor(env))
File "/usr/local/lib/python3.7/site-packages/mypy/types.py", line 524, in accept
return visitor.visit_instance(self)
File "/usr/local/lib/python3.7/site-packages/mypy/expandtype.py", line 83, in visit_instance
args = self.expand_types(t.args)
File "/usr/local/lib/python3.7/site-packages/mypy/expandtype.py", line 132, in expand_types
a.append(t.accept(self))
File "/usr/local/lib/python3.7/site-packages/mypy/types.py", line 1532, in accept
return visitor.visit_forwardref_type(self)
File "/usr/local/lib/python3.7/site-packages/mypy/type_visitor.py", line 101, in visit_forwardref_type
raise RuntimeError('Internal error: unresolved forward reference')
RuntimeError: Internal error: unresolved forward reference
mypy_break.py:7: : note: use --pdb to drop into pdb
The text was updated successfully, but these errors were encountered:
tombo315
changed the title
Mapping[TypeVar, Union] under attrs breaks mypy
Forward References under attrs classes extending Generic breaks mypy
Nov 1, 2018
System information:
Minimal[-ish] example:
The text was updated successfully, but these errors were encountered: