Closed
Description
dmypy
crashes on import stripe
, and I reduced the failure to the minimal test case below with no external dependencies. This is similar to
but it remains a problem on current master
(e67decb) even after #17515 was marked fixed. This is a regression in v1.11.0, and git bisect
shows it was introduced by 1072c78 (#17148, cc @JelleZijlstra).
test.py
from typing import TypedDict
class A(TypedDict):
b: "B"
class B(TypedDict):
c: "C"
class C(TypedDict):
d: "D"
class D:
pass
$ mypy --show-traceback --cache-fine-grained test.py
test.py: 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://github.com/python/mypy/issues
version: 1.12.0+dev.e67decb91ea5aacbb1e126463b02d78ded680a90
Traceback (most recent call last):
File "/tmp/venv/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/home/anders/python/mypy/mypy/__main__.py", line 15, in console_entry
main()
File "/home/anders/python/mypy/mypy/main.py", line 103, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/home/anders/python/mypy/mypy/main.py", line 187, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/home/anders/python/mypy/mypy/build.py", line 193, in build
result = _build(
File "/home/anders/python/mypy/mypy/build.py", line 268, in _build
graph = dispatch(sources, manager, stdout)
File "/home/anders/python/mypy/mypy/build.py", line 2950, in dispatch
process_graph(graph, manager)
File "/home/anders/python/mypy/mypy/build.py", line 3348, in process_graph
process_stale_scc(graph, scc, manager)
File "/home/anders/python/mypy/mypy/build.py", line 3453, in process_stale_scc
graph[id].finish_passes()
File "/home/anders/python/mypy/mypy/build.py", line 2372, in finish_passes
with self.wrap_context():
File "/nix/store/z7xxy35k7620hs6fn6la5fg2lgklv72l-python3-3.12.4/lib/python3.12/contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "/home/anders/python/mypy/mypy/build.py", line 2069, in wrap_context
yield
File "/home/anders/python/mypy/mypy/build.py", line 2409, in finish_passes
self.update_fine_grained_deps(self.manager.fg_deps)
File "/home/anders/python/mypy/mypy/build.py", line 2467, in update_fine_grained_deps
merge_dependencies(self.compute_fine_grained_deps(), deps)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anders/python/mypy/mypy/build.py", line 2455, in compute_fine_grained_deps
return get_dependencies(
^^^^^^^^^^^^^^^^^
File "/home/anders/python/mypy/mypy/server/deps.py", line 187, in get_dependencies
target.accept(visitor)
File "/home/anders/python/mypy/mypy/nodes.py", line 372, in accept
return visitor.visit_mypy_file(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anders/python/mypy/mypy/server/deps.py", line 250, in visit_mypy_file
super().visit_mypy_file(o)
File "/home/anders/python/mypy/mypy/traverser.py", line 116, in visit_mypy_file
d.accept(self)
File "/home/anders/python/mypy/mypy/nodes.py", line 1183, in accept
return visitor.visit_class_def(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anders/python/mypy/mypy/server/deps.py", line 310, in visit_class_def
super().visit_class_def(o)
File "/home/anders/python/mypy/mypy/traverser.py", line 152, in visit_class_def
o.defs.accept(self)
File "/home/anders/python/mypy/mypy/nodes.py", line 1264, in accept
return visitor.visit_block(self)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anders/python/mypy/mypy/server/deps.py", line 429, in visit_block
super().visit_block(o)
File "/home/anders/python/mypy/mypy/traverser.py", line 120, in visit_block
s.accept(self)
File "/home/anders/python/mypy/mypy/nodes.py", line 1351, in accept
return visitor.visit_assignment_stmt(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anders/python/mypy/mypy/server/deps.py", line 490, in visit_assignment_stmt
self.add_type_dependencies(o.type)
File "/home/anders/python/mypy/mypy/server/deps.py", line 887, in add_type_dependencies
for trigger in self.get_type_triggers(typ):
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anders/python/mypy/mypy/server/deps.py", line 940, in get_type_triggers
return get_type_triggers(typ, self.use_logical_deps())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anders/python/mypy/mypy/server/deps.py", line 947, in get_type_triggers
return typ.accept(TypeTriggersVisitor(use_logical_deps, seen_aliases))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anders/python/mypy/mypy/types.py", line 2708, in accept
assert isinstance(visitor, SyntheticTypeVisitor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError:
test.py: : note: use --pdb to drop into pdb