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
from typing import TypedDict
class SomeEntry(TypedDict):
somefield: "set[str]"
Running mypy with --cache-fine-grained causes assertion error.
The assertion error is no longer raised if either of these is done:
using from __future__ import annotations and changing the types from strings to actual types.
removing --cache-fine-grained.
using mypy v1.10.1.
Repro and Traceback
$ python3 -m mypy --strict --cache-fine-grained --show-traceback ~/src/x-play
/home/svalentin/src/x-play/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.11.0+dev.d8c67c36d6ecf964dd283de3acffc59d80c8b1fd
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/svalentin/src/mypy/mypy/__main__.py", line 37, in <module>
console_entry()
File "/home/svalentin/src/mypy/mypy/__main__.py", line 15, in console_entry
main()
File "/home/svalentin/src/mypy/mypy/main.py", line 103, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/home/svalentin/src/mypy/mypy/main.py", line 187, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/home/svalentin/src/mypy/mypy/build.py", line 193, in build
result = _build(
File "/home/svalentin/src/mypy/mypy/build.py", line 268, in _build
graph = dispatch(sources, manager, stdout)
File "/home/svalentin/src/mypy/mypy/build.py", line 2944, in dispatch
return dispatch(sources, manager, stdout)
File "/home/svalentin/src/mypy/mypy/build.py", line 2950, in dispatch
process_graph(graph, manager)
File "/home/svalentin/src/mypy/mypy/build.py", line 3348, in process_graph
process_stale_scc(graph, scc, manager)
File "/home/svalentin/src/mypy/mypy/build.py", line 3453, in process_stale_scc
graph[id].finish_passes()
File "/home/svalentin/src/mypy/mypy/build.py", line 2372, in finish_passes
with self.wrap_context():
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/svalentin/src/mypy/mypy/build.py", line 2069, in wrap_context
yield
File "/home/svalentin/src/mypy/mypy/build.py", line 2409, in finish_passes
self.update_fine_grained_deps(self.manager.fg_deps)
File "/home/svalentin/src/mypy/mypy/build.py", line 2467, in update_fine_grained_deps
merge_dependencies(self.compute_fine_grained_deps(), deps)
File "/home/svalentin/src/mypy/mypy/build.py", line 2455, in compute_fine_grained_deps
return get_dependencies(
File "/home/svalentin/src/mypy/mypy/server/deps.py", line 187, in get_dependencies
target.accept(visitor)
File "/home/svalentin/src/mypy/mypy/nodes.py", line 372, in accept
return visitor.visit_mypy_file(self)
File "/home/svalentin/src/mypy/mypy/server/deps.py", line 250, in visit_mypy_file
super().visit_mypy_file(o)
File "/home/svalentin/src/mypy/mypy/traverser.py", line 116, in visit_mypy_file
d.accept(self)
File "/home/svalentin/src/mypy/mypy/nodes.py", line 1183, in accept
return visitor.visit_class_def(self)
File "/home/svalentin/src/mypy/mypy/server/deps.py", line 310, in visit_class_def
super().visit_class_def(o)
File "/home/svalentin/src/mypy/mypy/traverser.py", line 152, in visit_class_def
o.defs.accept(self)
File "/home/svalentin/src/mypy/mypy/nodes.py", line 1264, in accept
return visitor.visit_block(self)
File "/home/svalentin/src/mypy/mypy/server/deps.py", line 429, in visit_block
super().visit_block(o)
File "/home/svalentin/src/mypy/mypy/traverser.py", line 120, in visit_block
s.accept(self)
File "/home/svalentin/src/mypy/mypy/nodes.py", line 1351, in accept
return visitor.visit_assignment_stmt(self)
File "/home/svalentin/src/mypy/mypy/server/deps.py", line 490, in visit_assignment_stmt
self.add_type_dependencies(o.type)
File "/home/svalentin/src/mypy/mypy/server/deps.py", line 887, in add_type_dependencies
for trigger in self.get_type_triggers(typ):
File "/home/svalentin/src/mypy/mypy/server/deps.py", line 940, in get_type_triggers
return get_type_triggers(typ, self.use_logical_deps())
File "/home/svalentin/src/mypy/mypy/server/deps.py", line 947, in get_type_triggers
return typ.accept(TypeTriggersVisitor(use_logical_deps, seen_aliases))
File "/home/svalentin/src/mypy/mypy/types.py", line 2703, in accept
assert isinstance(visitor, SyntheticTypeVisitor)
AssertionError:
/home/svalentin/src/x-play/test.py: : note: use --pdb to drop into pdb
Your Environment
Ubuntu 22.04.4 LTS (Jammy Jellyfish)
Writing your example to test.py and adding # flags: --cache-fine-grained --strict then running mypy_primer -p test.py --bisect --debug --old 'v1.10.0' bisects this to #17148 cc @JelleZijlstra
Crash Report
Make a file with:
Running mypy with
--cache-fine-grained
causes assertion error.The assertion error is no longer raised if either of these is done:
from __future__ import annotations
and changing the types from strings to actual types.--cache-fine-grained
.Repro and Traceback
Your Environment
Ubuntu 22.04.4 LTS (Jammy Jellyfish)
The text was updated successfully, but these errors were encountered: