Either both of these should error, or neither of them.
deftest1(items: tuple[int, ...]) ->None:
reveal_type(items[1]) # ✅️reveal_type(items[2]) # ✅️reveal_type(items[3]) # ✅️deftest2(items: tuple[int, *tuple[int, ...]]) ->None:
reveal_type(items[1]) # ❌️ tuple index out of rangereveal_type(items[2]) # ❌️ tuple index out of rangereveal_type(items[3]) # ❌️ tuple index out of range
I encountered this as a result of my draft PR #20472, which introduces more precise tuple handling, that can introduce tuple[T, *tuple[...]] for instance from handling unions of tuples.
Activity
randolf-scholz commented on Dec 26, 2025
Looks to be a duplicate of #19109 and #18665.
I encountered this as a result of my draft PR #20472, which introduces more precise tuple handling, that can introduce tuple[T, *tuple[...]] for instance from handling unions of tuples.