Skip to content
2 changes: 1 addition & 1 deletion stdlib/@tests/stubtest_allowlists/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ typing.type_check_only # typing decorator that is not available at runtime
# Details of runtime definition don't need to be in stubs
typing._Final
typing._Final.__init_subclass__
typing(_extensions)?\._TypedDict
typing(_extensions)?\.Any.*
typing(_extensions)?\.TypedDict
typing_extensions._TypedDict

# Special primitives
typing(_extensions)?\.AbstractSet
Expand Down
48 changes: 1 addition & 47 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import collections # ruff: ignore[unused-import] # pyright: ignore[reportUnusedImport]
import sys
import typing_extensions
from _collections_abc import dict_items, dict_keys, dict_values
from _typeshed import IdentityFunction, ReadableBuffer, SupportsGetItem, SupportsGetItemViewable, SupportsKeysAndGetItem, Viewable
from abc import ABCMeta, abstractmethod
from re import Match as Match, Pattern as Pattern
Expand All @@ -21,7 +20,7 @@ from types import (
UnionType,
WrapperDescriptorType,
)
from typing_extensions import Never as _Never, deprecated
from typing_extensions import deprecated

if sys.version_info >= (3, 14):
from _typeshed import EvaluateFunc
Expand Down Expand Up @@ -1076,51 +1075,6 @@ class NamedTuple(tuple[Any, ...]):
if sys.version_info >= (3, 13):
def __replace__(self, **kwargs: Any) -> typing_extensions.Self: ... # ty:ignore[invalid-type-form]

# Internal mypy fallback type for all typed dicts (does not exist at runtime)
# N.B. Keep this mostly in sync with typing_extensions._TypedDict/mypy_extensions._TypedDict
# Obsolete, use _typeshed._type_checker_internals.TypedDictFallback instead.
@type_check_only
class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
__total__: ClassVar[bool]
__required_keys__: ClassVar[frozenset[str]]
__optional_keys__: ClassVar[frozenset[str]]
# __orig_bases__ sometimes exists on <3.12, but not consistently,
# so we only add it to the stub on 3.12+
if sys.version_info >= (3, 12):
__orig_bases__: ClassVar[tuple[Any, ...]]
if sys.version_info >= (3, 13):
__readonly_keys__: ClassVar[frozenset[str]]
__mutable_keys__: ClassVar[frozenset[str]]
if sys.version_info >= (3, 15):
# PEP 728
__closed__: ClassVar[bool | None]
__extra_items__: ClassVar[Any] # AnnotationForm

def copy(self) -> typing_extensions.Self: ...
# Using Never so that only calls using mypy plugin hook that specialize the signature
# can go through.
def setdefault(self, k: _Never, default: object) -> object: ...
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
def pop(self, k: _Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
def update(self, m: typing_extensions.Self, /) -> None: ...
def __delitem__(self, k: _Never) -> None: ...
def items(self) -> dict_items[str, object]: ...
def keys(self) -> dict_keys[str, object]: ...
def values(self) -> dict_values[str, object]: ...

@overload
def __or__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ...
@overload
def __or__(self, value: dict[str, Any], /) -> dict[str, object]: ...

@overload
def __ror__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ...
@overload
def __ror__(self, value: dict[str, Any], /) -> dict[str, object]: ...

# supposedly incompatible definitions of __or__ and __ior__
def __ior__(self, value: typing_extensions.Self, /) -> typing_extensions.Self: ... # type: ignore[misc]

if sys.version_info >= (3, 14):
from annotationlib import ForwardRef as ForwardRef

Expand Down
Loading