diff --git a/stdlib/@tests/stubtest_allowlists/py310.txt b/stdlib/@tests/stubtest_allowlists/py310.txt index 58e826f7081b..21eb7537ca51 100644 --- a/stdlib/@tests/stubtest_allowlists/py310.txt +++ b/stdlib/@tests/stubtest_allowlists/py310.txt @@ -284,3 +284,9 @@ typing\.Annotated # Super-special typing primitive # These methods have no default implementation for Python < 3.13. _pickle.Pickler.persistent_id _pickle.Unpickler.persistent_load + +# `name` is a positional string literal for these special forms (PEP 484 / 612); +# the stub marks it positional-only, but the pure-Python 3.10 runtime objects +# accept it as a keyword argument. +typing.ParamSpec.__init__ +typing.TypeVar.__init__ diff --git a/stdlib/@tests/stubtest_allowlists/py311.txt b/stdlib/@tests/stubtest_allowlists/py311.txt index 11af276eb139..7a7b4006985b 100644 --- a/stdlib/@tests/stubtest_allowlists/py311.txt +++ b/stdlib/@tests/stubtest_allowlists/py311.txt @@ -261,3 +261,8 @@ typing\.Annotated # Super-special typing primitive # These methods have no default implementation for Python < 3.13. _pickle.Pickler.persistent_id _pickle.Unpickler.persistent_load + +# `name` is a positional string literal for TypeVarTuple (PEP 646); the stub +# marks it positional-only, but the pure-Python 3.11 runtime __init__ accepts +# it as a keyword argument. +typing.TypeVarTuple.__init__ diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 2018a835c632..d4580ed84daa 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -178,6 +178,7 @@ class TypeVar: def __new__( cls, name: str, + /, *constraints: Any, # AnnotationForm bound: Any | None = None, # AnnotationForm contravariant: bool = False, @@ -189,6 +190,7 @@ class TypeVar: def __new__( cls, name: str, + /, *constraints: Any, # AnnotationForm bound: Any | None = None, # AnnotationForm covariant: bool = False, @@ -199,6 +201,7 @@ class TypeVar: def __new__( cls, name: str, + /, *constraints: Any, # AnnotationForm bound: Any | None = None, # AnnotationForm covariant: bool = False, @@ -208,6 +211,7 @@ class TypeVar: def __init__( self, name: str, + /, *constraints: Any, # AnnotationForm bound: Any | None = None, # AnnotationForm covariant: bool = False, @@ -280,6 +284,7 @@ if sys.version_info >= (3, 11): def __new__( cls, name: str, + /, *, bound: Any | None = None, # AnnotationForm covariant: bool = False, @@ -288,11 +293,11 @@ if sys.version_info >= (3, 11): infer_variance: bool = False, ) -> Self: ... elif sys.version_info >= (3, 13): - def __new__(cls, name: str, *, default: Any = ...) -> Self: ... # AnnotationForm + def __new__(cls, name: str, /, *, default: Any = ...) -> Self: ... # AnnotationForm elif sys.version_info >= (3, 12): - def __new__(cls, name: str) -> Self: ... + def __new__(cls, name: str, /) -> Self: ... else: - def __init__(self, name: str) -> None: ... + def __init__(self, name: str, /) -> None: ... def __iter__(self) -> Any: ... def __typing_subst__(self, arg: Never, /) -> Never: ... @@ -345,6 +350,7 @@ class ParamSpec: def __new__( cls, name: str, + /, *, bound: Any | None = None, # AnnotationForm contravariant: bool = False, @@ -356,6 +362,7 @@ class ParamSpec: def __new__( cls, name: str, + /, *, bound: Any | None = None, # AnnotationForm contravariant: bool = False, @@ -364,11 +371,17 @@ class ParamSpec: ) -> Self: ... elif sys.version_info >= (3, 11): def __new__( - cls, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False # AnnotationForm + cls, name: str, /, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False # AnnotationForm ) -> Self: ... else: def __init__( - self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False # AnnotationForm + self, + name: str, + /, + *, + bound: Any | None = None, + contravariant: bool = False, + covariant: bool = False, # AnnotationForm ) -> None: ... @property