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
Trying to define a tuple with at least 1 element (tuple[T, *tuple[T, ...]]) causes a crash if you try to define a tuple with exactly 1 element.
Traceback
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/__main__.py", line 37, in <module>
console_entry()
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/__main__.py", line 15, in console_entry
main()
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/main.py", line 100, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/main.py", line 182, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/build.py", line 191, in build
result = _build(
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/build.py", line 265, in _build
graph = dispatch(sources, manager, stdout)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/build.py", line 2943, in dispatch
process_graph(graph, manager)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/build.py", line 3341, in process_graph
process_stale_scc(graph, scc, manager)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/build.py", line 3442, in process_stale_scc
graph[id].type_check_first_pass()
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/build.py", line 2311, in type_check_first_pass
self.type_checker().check_first_pass()
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/checker.py", line 481, in check_first_pass
self.accept(d)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/checker.py", line 591, in accept
stmt.accept(self)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/nodes.py", line 1308, in accept
return visitor.visit_assignment_stmt(self)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/checker.py", line 2817, in visit_assignment_stmt
self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/checker.py", line 2994, in check_assignment
rvalue_type = self.check_simple_assignment(lvalue_type, rvalue, context=rvalue)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/checker.py", line 4147, in check_simple_assignment
rvalue_type = self.expr_checker.accept(
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/checkexpr.py", line 5716, in accept
typ = node.accept(self)
^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/nodes.py", line 2267, in accept
return visitor.visit_tuple_expr(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/checkexpr.py", line 4929, in visit_tuple_expr
if isinstance(type_context, TupleType) and self.tuple_context_matches(e, type_context):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/mypy/checkexpr.py", line 4907, in tuple_context_matches
expr_star_index = next(i for i, lv in enumerate(expr.items) if isinstance(lv, StarExpr))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration:
main.py:5: 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.8.0+dev.a1864d4fa498ccd8773c2247eb62282644174d26
main.py:5: : note: use --pdb to drop into pdb
Crash Report
Trying to define a tuple with at least 1 element (
tuple[T, *tuple[T, ...]]
) causes a crash if you try to define a tuple with exactly 1 element.Traceback
To Reproduce
The line defining
z
in the playground is the one that causes the crash.https://mypy-play.net/?mypy=master&python=3.12&flags=show-traceback&gist=6f394a4996dfcb54c263e1e72e3710a1
Your Environment
I don't believe any of this matters in this instance because the same issue happens on the playground as well.
The text was updated successfully, but these errors were encountered: