Mypy crashes with the following traceback. Small reproducer below. Tested with version 0.991 (compiled) and mypy master (not compiled).
$ mypy --show-traceback t.py
t.py:3: 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.0.0+dev.b8c03ab6809aab56928f3cd865edb44944a600a2
Traceback (most recent call last):
File "/tmp/venv/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/tmp/venv/lib/python3.10/site-packages/mypy/__main__.py", line 15, in console_entry
main()
File "/tmp/venv/lib/python3.10/site-packages/mypy/main.py", line 95, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/tmp/venv/lib/python3.10/site-packages/mypy/main.py", line 174, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 194, in build
result = _build(
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 277, in _build
graph = dispatch(sources, manager, stdout)
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 2914, in dispatch
process_graph(graph, manager)
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 3311, in process_graph
process_stale_scc(graph, scc, manager)
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 3412, in process_stale_scc
graph[id].type_check_first_pass()
File "/tmp/venv/lib/python3.10/site-packages/mypy/build.py", line 2317, in type_check_first_pass
self.type_checker().check_first_pass()
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 471, in check_first_pass
self.accept(d)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 579, in accept
stmt.accept(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/nodes.py", line 790, in accept
return visitor.visit_func_def(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 956, in visit_func_def
self._visit_func_def(defn)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 960, in _visit_func_def
self.check_func_item(defn, name=defn.name)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 1032, in check_func_item
self.check_func_def(defn, typ, name, allow_empty)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 1212, in check_func_def
self.accept(item.body)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 579, in accept
stmt.accept(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/nodes.py", line 1202, in accept
return visitor.visit_block(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 2592, in visit_block
self.accept(s)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 579, in accept
stmt.accept(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/nodes.py", line 1289, in accept
return visitor.visit_assignment_stmt(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 2640, in visit_assignment_stmt
self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 2695, in check_assignment
self.check_assignment_to_multiple_lvalues(
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 3349, in check_assignment_to_multiple_lvalues self.check_multi_assignment(lvalues, rvalue, context, infer_lvalue_type)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 3396, in check_multi_assignment
self.check_multi_assignment_from_tuple(
File "/tmp/venv/lib/python3.10/site-packages/mypy/checker.py", line 3511, in check_multi_assignment_from_tuple
self.expr_checker.accept(rvalue, lvalue_type)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checkexpr.py", line 4768, in accept
typ = node.accept(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/nodes.py", line 1871, in accept
return visitor.visit_call_expr(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checkexpr.py", line 424, in visit_call_expr
return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checkexpr.py", line 544, in visit_call_expr_inner
ret_type = self.check_call_expr_with_callee_type(
File "/tmp/venv/lib/python3.10/site-packages/mypy/checkexpr.py", line 1195, in check_call_expr_with_callee_type
ret_type, callee_type = self.check_call(
File "/tmp/venv/lib/python3.10/site-packages/mypy/checkexpr.py", line 1289, in check_call
return self.check_overload_call(
File "/tmp/venv/lib/python3.10/site-packages/mypy/checkexpr.py", line 2211, in check_overload_call
inferred_result = self.infer_overload_return_type(
File "/tmp/venv/lib/python3.10/site-packages/mypy/checkexpr.py", line 2365, in infer_overload_return_type
ret_type, infer_type = self.check_call(
File "/tmp/venv/lib/python3.10/site-packages/mypy/checkexpr.py", line 1278, in check_call
return self.check_callable_call(
File "/tmp/venv/lib/python3.10/site-packages/mypy/checkexpr.py", line 1419, in check_callable_call
callee = self.infer_function_type_arguments_using_context(callee, context)
File "/tmp/venv/lib/python3.10/site-packages/mypy/checkexpr.py", line 1648, in infer_function_type_arguments_using_context
erased_ctx = replace_meta_vars(ctx, ErasedType())
File "/tmp/venv/lib/python3.10/site-packages/mypy/erasetype.py", line 153, in replace_meta_vars
return t.accept(TypeVarEraser(lambda id: id.is_meta_var(), target_type))
File "/tmp/venv/lib/python3.10/site-packages/mypy/types.py", line 2205, in accept
return visitor.visit_tuple_type(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/type_visitor.py", line 249, in visit_tuple_type
self.translate_types(t.items),
File "/tmp/venv/lib/python3.10/site-packages/mypy/type_visitor.py", line 276, in translate_types
return [t.accept(self) for t in types]
File "/tmp/venv/lib/python3.10/site-packages/mypy/type_visitor.py", line 276, in <listcomp>
return [t.accept(self) for t in types]
File "/tmp/venv/lib/python3.10/site-packages/mypy/types.py", line 2205, in accept
return visitor.visit_tuple_type(self)
File "/tmp/venv/lib/python3.10/site-packages/mypy/type_visitor.py", line 249, in visit_tuple_type
self.translate_types(t.items),
File "/tmp/venv/lib/python3.10/site-packages/mypy/type_visitor.py", line 276, in translate_types
return [t.accept(self) for t in types]
File "/tmp/venv/lib/python3.10/site-packages/mypy/type_visitor.py", line 276, in <listcomp>
return [t.accept(self) for t in types]
File "/tmp/venv/lib/python3.10/site-packages/mypy/types.py", line 2566, in accept
assert isinstance(visitor, SyntheticTypeVisitor)
AssertionError:
t.py:3: : note: use --pdb to drop into pdb
$ cat t.py
def mypy_crash() -> None:
d: dict[int, tuple[str, int, str]] = {}
k, (v1, *_) = next(iter(d.items())) # <-- mypy crashes here
Crash Report
Mypy crashes with the following traceback. Small reproducer below. Tested with version 0.991 (compiled) and mypy master (not compiled).
Traceback
To Reproduce
Your Environment
mypy 1.0.0+dev.b8c03ab6809aab56928f3cd865edb44944a600a2 (compiled: no)(installed withpip install git+https://github.com/python/mypy#master)mypy t.pymypy.ini(and other config files): NonePython 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0]Ubuntu 22.04.1 LTS on Windows 10 x86_645.15.74.2-microsoft-standard-WSL2