Skip to content

Commit

Permalink
typing(_extensions) updates for py313 (#12030)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood authored May 24, 2024
1 parent 0152a6c commit 2985ef4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
10 changes: 1 addition & 9 deletions stdlib/@tests/stubtest_allowlists/py313.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,6 @@ turtle.settiltangle
types.CodeType.__replace__
types.MappingProxyType.get
types.SimpleNamespace.__replace__
typing.ForwardRef._evaluate
typing.ReadOnly
typing.TypeIs
typing.TypeVar.__typing_prepare_subst__
typing.__all__
typing_extensions.ForwardRef._evaluate
typing_extensions.Protocol
typing_extensions.ReadOnly
typing_extensions.TypeIs
unittest.IsolatedAsyncioTestCase.loop_factory
unittest.TestProgram.usageExit
unittest.__all__
Expand Down Expand Up @@ -381,6 +372,7 @@ importlib.metadata.DeprecatedNonAbstract.__new__
typing\._SpecialForm.*
typing\.NamedTuple
typing\.LiteralString
typing_extensions.Protocol

# These only exist to give a better error message if you try to subclass an instance
typing.ParamSpec.__mro_entries__
Expand Down
16 changes: 14 additions & 2 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ if sys.version_info >= (3, 12):
__all__ += ["TypeAliasType", "override"]

if sys.version_info >= (3, 13):
__all__ += ["get_protocol_members", "is_protocol", "NoDefault"]
__all__ += ["get_protocol_members", "is_protocol", "NoDefault", "TypeIs", "ReadOnly"]

Any = object()

Expand Down Expand Up @@ -183,6 +183,7 @@ class TypeVar:
if sys.version_info >= (3, 11):
def __typing_subst__(self, arg: Any) -> Any: ...
if sys.version_info >= (3, 13):
def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
def has_default(self) -> bool: ...

# Used for an undocumented mypy feature. Does not exist at runtime.
Expand Down Expand Up @@ -989,7 +990,16 @@ class ForwardRef:
else:
def __init__(self, arg: str, is_argument: bool = True) -> None: ...

if sys.version_info >= (3, 9):
if sys.version_info >= (3, 13):
def _evaluate(
self,
globalns: dict[str, Any] | None,
localns: dict[str, Any] | None,
type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ...,
*,
recursive_guard: frozenset[str],
) -> Any | None: ...
elif sys.version_info >= (3, 9):
def _evaluate(
self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None, recursive_guard: frozenset[str]
) -> Any | None: ...
Expand Down Expand Up @@ -1036,3 +1046,5 @@ if sys.version_info >= (3, 13):
class _NoDefaultType: ...

NoDefault: _NoDefaultType
TypeIs: _SpecialForm
ReadOnly: _SpecialForm
8 changes: 5 additions & 3 deletions stdlib/typing_extensions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ if sys.version_info >= (3, 13):
from typing import (
NoDefault as NoDefault,
ParamSpec as ParamSpec,
ReadOnly as ReadOnly,
TypeIs as TypeIs,
TypeVar as TypeVar,
TypeVarTuple as TypeVarTuple,
get_protocol_members as get_protocol_members,
Expand Down Expand Up @@ -520,11 +522,11 @@ else:
def has_default(self) -> bool: ...
def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...

ReadOnly: _SpecialForm
TypeIs: _SpecialForm

class Doc:
documentation: str
def __init__(self, documentation: str, /) -> None: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...

ReadOnly: _SpecialForm
TypeIs: _SpecialForm

0 comments on commit 2985ef4

Please sign in to comment.