Closed
Description
A recent change to the tuple.__new__
method in builtins.pyi
introduced an overload:
@overload
def __new__(cls) -> tuple[()]: ...
This overload is problematic for classes that derive from specialized tuples.
class MyTuple(tuple[int, str, str]):
...
x = MyTuple()
reveal_type(x) # tuple[()] !!!!
Because of this overload, the wrong type is evaluated.
I think this overload should return Self
, not tuple[()]
. Admittedly, that doesn't produce the ideal type evaluation for tuple()
. It produces tuple[Any, ...]
rather than tuple[()]
.
Metadata
Metadata
Assignees
Labels
No labels