Skip to content

Commit 10c1405

Browse files
carljmAlexWaygood
andauthored
Update typing_extensions to >=4.16.0rc2 (#15946)
* Update typing_extensions.TypeVarTuple with new backported features * Update typing_extensions to 4.16.0rc2 --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent d804ee4 commit 10c1405

4 files changed

Lines changed: 57 additions & 6 deletions

File tree

requirements-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ stubdefaulter==0.1.0; python_version < "3.15"
1717
termcolor>=2.3
1818
tomli==2.4.1; python_version < "3.11"
1919
tomlkit==0.14.0
20-
typing_extensions>=4.16.0rc1
20+
typing_extensions>=4.16.0rc2
2121
uv==0.11.15
2222

2323
# Utilities for typeshed infrastructure scripts.

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ tkinter.simpledialog.TkVersion
6666
# that describes the way users are supposed to call the constructor.
6767
typing_extensions.sentinel.__init__
6868

69+
# TypeVarTuple is a wrapper class that returns typing.TypeVarTuple instances.
70+
# Keep __new__ checked because it is the wrapper's public constructor.
71+
typing_extensions\.TypeVarTuple
72+
typing_extensions\.TypeVarTuple\.(?!__new__).*
73+
6974

7075
# =============================================================
7176
# Allowlist entries that cannot or should not be fixed; <3.15

stdlib/@tests/stubtest_allowlists/py314.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ tkinter.simpledialog.TkVersion
6666
# that describes the way users are supposed to call the constructor.
6767
typing_extensions.sentinel.__init__
6868

69+
# TypeVarTuple is a wrapper class that returns typing.TypeVarTuple instances.
70+
# Keep __new__ checked because it is the wrapper's public constructor.
71+
typing_extensions\.TypeVarTuple
72+
typing_extensions\.TypeVarTuple\.(?!__new__).*
73+
6974

7075
# =============================================================
7176
# Allowlist entries that cannot or should not be fixed; <3.15

stdlib/typing_extensions.pyi

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ from typing import ( # noqa: Y022,Y037,Y038,Y039,UP035
7171
type_check_only,
7272
)
7373

74+
if sys.version_info >= (3, 14):
75+
from _typeshed import EvaluateFunc
76+
7477
# Please keep order the same as at runtime.
7578
__all__ = [
7679
# Super-special typing primitives.
@@ -458,7 +461,6 @@ if sys.version_info >= (3, 13):
458461
ReadOnly as ReadOnly,
459462
TypeIs as TypeIs,
460463
TypeVar as TypeVar,
461-
TypeVarTuple as TypeVarTuple,
462464
get_protocol_members as get_protocol_members,
463465
is_protocol as is_protocol,
464466
)
@@ -547,19 +549,58 @@ else:
547549
def has_default(self) -> bool: ...
548550
def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
549551

552+
ReadOnly: _SpecialForm
553+
TypeIs: _SpecialForm
554+
555+
if sys.version_info >= (3, 15):
556+
from typing import TypeVarTuple as TypeVarTuple
557+
else:
550558
@final
551559
class TypeVarTuple:
552560
@property
553561
def __name__(self) -> str: ...
554562
@property
563+
def __bound__(self) -> AnnotationForm | None: ...
564+
@property
565+
def __covariant__(self) -> bool: ...
566+
@property
567+
def __contravariant__(self) -> bool: ...
568+
@property
569+
def __infer_variance__(self) -> bool: ...
570+
@property
555571
def __default__(self) -> AnnotationForm: ...
556-
def __init__(self, name: str, *, default: AnnotationForm = ...) -> None: ...
572+
if sys.version_info >= (3, 11):
573+
def __new__(
574+
cls,
575+
name: str,
576+
*,
577+
bound: AnnotationForm | None = None,
578+
covariant: bool = False,
579+
contravariant: bool = False,
580+
infer_variance: bool = False,
581+
default: AnnotationForm = ...,
582+
) -> Self: ...
583+
else:
584+
def __init__(
585+
self,
586+
name: str,
587+
*,
588+
bound: AnnotationForm | None = None,
589+
covariant: bool = False,
590+
contravariant: bool = False,
591+
infer_variance: bool = False,
592+
default: AnnotationForm = ...,
593+
) -> None: ...
594+
557595
def __iter__(self) -> Any: ... # Unpack[Self]
558596
def has_default(self) -> bool: ...
559-
def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
597+
if sys.version_info >= (3, 11):
598+
def __typing_subst__(self, arg: Never, /) -> Never: ...
560599

561-
ReadOnly: _SpecialForm
562-
TypeIs: _SpecialForm
600+
def __typing_prepare_subst__(self, alias: Any, args: Any, /) -> tuple[Any, ...]: ...
601+
if sys.version_info >= (3, 14):
602+
@property
603+
def evaluate_default(self) -> EvaluateFunc | None: ...
563604

564605
# TypeAliasType was added in Python 3.12, but had significant changes in 3.14.
565606
if sys.version_info >= (3, 14):

0 commit comments

Comments
 (0)