-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
crashtopic-pep-646PEP 646 (TypeVarTuple, Unpack)PEP 646 (TypeVarTuple, Unpack)topic-pep-695Issues related to PEP 695 syntaxIssues related to PEP 695 syntax
Description
Crash Report
The snippet below crashes mypy 1.19.1 and master (f363f35).
Traceback
Traceback (most recent call last):
File ".venv-mypy/bin/mypy", line 6, in <module>
sys.exit(console_entry())
File "mypy/mypy/__main__.py", line 15, in console_entry
main()
File "mypy/mypy/main.py", line 130, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "mypy/mypy/main.py", line 214, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "mypy/mypy/build.py", line 378, in build
result = build_inner(
File "mypy/mypy/build.py", line 478, in build_inner
graph = dispatch(sources, manager, stdout)
File "mypy/mypy/build.py", line 3652, in dispatch
process_graph(graph, manager)
File "mypy/mypy/build.py", line 4105, in process_graph
done, still_working, results = manager.wait_for_done(graph)
File "mypy/mypy/build.py", line 1173, in wait_for_done
process_stale_scc(graph, next_scc, self)
File "mypy/mypy/build.py", line 4268, in process_stale_scc
mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
File "mypy/mypy/semanal_main.py", line 92, in semantic_analysis_for_scc
process_top_levels(graph, scc, patches)
File "mypy/mypy/semanal_main.py", line 230, in process_top_levels
deferred, incomplete, progress = semantic_analyze_target(
File "mypy/mypy/semanal_main.py", line 407, in semantic_analyze_target
analyzer.refresh_partial(
File "mypy/mypy/semanal.py", line 701, in refresh_partial
self.refresh_top_level(node)
File "mypy/mypy/semanal.py", line 719, in refresh_top_level
self.accept(d)
File "mypy/mypy/semanal.py", line 7627, in accept
node.accept(self)
~~~~~~~~~~~^^^^^^
File "mypy/mypy/nodes.py", line 1752, in accept
return visitor.visit_assignment_stmt(self)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "mypy/mypy/semanal.py", line 3345, in visit_assignment_stmt
self.process_type_annotation(s)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
File "mypy/mypy/semanal.py", line 3883, in process_type_annotation
if analyzed is None or has_placeholder(analyzed):
~~~~~~~~~~~~~~~^^^^^^^^^^
File "mypy/mypy/semanal_shared.py", line 377, in has_placeholder
return typ.accept(HasPlaceholders())
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "mypy/mypy/types.py", line 418, in accept
return visitor.visit_type_alias_type(self)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "mypy/mypy/type_visitor.py", line 598, in visit_type_alias_type
return get_proper_type(t).accept(self)
~~~~~~~~~~~~~~~^^^
File "mypy/mypy/types.py", line 3648, in get_proper_type
typ = typ._expand_once()
File "mypy/mypy/types.py", line 382, in _expand_once
return self.alias.target.accept(InstantiateAliasVisitor(mapping))
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "mypy/mypy/types.py", line 1672, in accept
return visitor.visit_instance(self)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "mypy/mypy/expandtype.py", line 215, in visit_instance
args = self.expand_type_tuple_with_unpack(t.args)
File "mypy/mypy/expandtype.py", line 533, in expand_type_tuple_with_unpack
items.append(item.accept(self))
~~~~~~~~~~~^^^^^^
File "mypy/mypy/types.py", line 1236, in accept
return visitor.visit_unpack_type(self)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "mypy/mypy/expandtype.py", line 387, in visit_unpack_type
return UnpackType(t.type.accept(self))
~~~~~~~~~~~~~^^^^^^
File "mypy/mypy/types.py", line 1672, in accept
return visitor.visit_instance(self)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "mypy/mypy/expandtype.py", line 228, in visit_instance
arg = args[0]
~~~~^^^
IndexError: list index out of rangeTo Reproduce
from typing import Unpack
class C[*Ts]:
pass
type T[T, *Ts] = C[*Ts]
x: T[bool, Unpack[tuple[()]]]Your Environment
- Mypy version used: 1.19.1 and f363f35
- Mypy command-line flags: N/A
- Mypy configuration options from
mypy.ini(and other config files): N/A - Python version used: 3.14.3
- Operating system and version: Arch Linux
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
crashtopic-pep-646PEP 646 (TypeVarTuple, Unpack)PEP 646 (TypeVarTuple, Unpack)topic-pep-695Issues related to PEP 695 syntaxIssues related to PEP 695 syntax