Repository navigation
dmypy crash with “Invalid type comment or annotation” #10007
Copy link
Copy link
Closed
Labels
Description
Crash Report
On a fresh checkout of mypy HEAD, with foo.py containing
from typing import TypedDict
class C(TypedDict):
a: {"c": int}
the command python -m mypy.dmypy run foo.py crashes the daemon.
If I run just mypy, without the daemon, I get the error
foo.py:4: error: Invalid type comment or annotation
but dmypy doesn’t seem to get far enough to report that.
Traceback
Details
Daemon started
Daemon crashed!
Traceback (most recent call last):
File "~/git/mypy/mypy/dmypy_server.py", line 221, in serve
resp = self.run_command(command, data)
File "~/git/mypy/mypy/dmypy_server.py", line 264, in run_command
return method(self, **data)
File "~/git/mypy/mypy/dmypy_server.py", line 323, in cmd_run
return self.check(sources, is_tty, terminal_width)
File "~/git/mypy/mypy/dmypy_server.py", line 380, in check
res = self.initialize_fine_grained(sources, is_tty, terminal_width)
File "~/git/mypy/mypy/dmypy_server.py", line 410, in initialize_fine_grained
result = mypy.build.build(sources=sources,
File "~/git/mypy/mypy/build.py", line 180, in build
result = _build(
File "~/git/mypy/mypy/build.py", line 254, in _build
graph = dispatch(sources, manager, stdout)
File "~/git/mypy/mypy/build.py", line 2656, in dispatch
process_graph(graph, manager)
File "~/git/mypy/mypy/build.py", line 2982, in process_graph
process_stale_scc(graph, scc, manager)
File "~/git/mypy/mypy/build.py", line 3083, in process_stale_scc
graph[id].finish_passes()
File "~/git/mypy/mypy/build.py", line 2177, in finish_passes
self.update_fine_grained_deps(self.manager.fg_deps)
File "~/git/mypy/mypy/build.py", line 2225, in update_fine_grained_deps
merge_dependencies(self.compute_fine_grained_deps(), deps)
File "~/git/mypy/mypy/build.py", line 2216, in compute_fine_grained_deps
return get_dependencies(target=self.tree,
File "~/git/mypy/mypy/server/deps.py", line 114, in get_dependencies
target.accept(visitor)
File "~/git/mypy/mypy/nodes.py", line 305, in accept
return visitor.visit_mypy_file(self)
File "~/git/mypy/mypy/server/deps.py", line 176, in visit_mypy_file
super().visit_mypy_file(o)
File "~/git/mypy/mypy/traverser.py", line 35, in visit_mypy_file
d.accept(self)
File "~/git/mypy/mypy/nodes.py", line 950, in accept
return visitor.visit_class_def(self)
File "~/git/mypy/mypy/server/deps.py", line 239, in visit_class_def
super().visit_class_def(o)
File "~/git/mypy/mypy/traverser.py", line 71, in visit_class_def
o.defs.accept(self)
File "~/git/mypy/mypy/nodes.py", line 1015, in accept
return visitor.visit_block(self)
File "~/git/mypy/mypy/server/deps.py", line 351, in visit_block
super().visit_block(o)
File "~/git/mypy/mypy/traverser.py", line 39, in visit_block
s.accept(self)
File "~/git/mypy/mypy/nodes.py", line 1073, in accept
return visitor.visit_assignment_stmt(self)
File "~/git/mypy/mypy/server/deps.py", line 411, in visit_assignment_stmt
self.add_type_dependencies(o.type)
File "~/git/mypy/mypy/server/deps.py", line 808, in add_type_dependencies
for trigger in self.get_type_triggers(typ):
File "~/git/mypy/mypy/server/deps.py", line 861, in get_type_triggers
return get_type_triggers(typ, self.use_logical_deps())
File "~/git/mypy/mypy/server/deps.py", line 866, in get_type_triggers
return typ.accept(TypeTriggersVisitor(use_logical_deps))
File "~/git/mypy/mypy/types.py", line 1620, in accept
assert isinstance(visitor, SyntheticTypeVisitor)
AssertionError
To Reproduce
See above
Your Environment
python 3.9.1 on macOS 11.1
Reactions are currently unavailable
Activity
Stop TypedDictAnalyzer from leaking synthetic types
Stop TypedDictAnalyzer from leaking synthetic types
Stop TypedDictAnalyzer from leaking synthetic types
Fix crash with malformed TypedDicts and disllow-any-expr
Fix crash with malformed TypedDicts and disllow-any-expr (#13963)
Fix daemon crash on invalid type in TypedDict (python#17495)
Fix daemon crash on invalid type in TypedDict (#17495)