diff --git a/stdlib/@tests/stubtest_allowlists/py315.txt b/stdlib/@tests/stubtest_allowlists/py315.txt index d76872ab2ebb..39ca2ce908cf 100644 --- a/stdlib/@tests/stubtest_allowlists/py315.txt +++ b/stdlib/@tests/stubtest_allowlists/py315.txt @@ -2,7 +2,6 @@ # TODO: Allowlist entries that should be fixed # ============================================ -_collections_abc.__all__ _frozen_importlib.BuiltinImporter.load_module _frozen_importlib.FrozenImporter.load_module _frozen_importlib_external.FileFinder.discover @@ -143,7 +142,6 @@ codecs.strict_errors codecs.xmlcharrefreplace_errors collections.Counter.__ixor__ collections.Counter.__xor__ -collections.abc.__all__ concurrent.interpreters._crossinterp.UNBOUND_ERROR concurrent.interpreters._crossinterp.UNBOUND_REMOVE concurrent.interpreters._crossinterp.UnboundItem.singleton @@ -391,25 +389,16 @@ types.UnionType.__qualname__ types.__all__ typing.LiteralString typing.NewType.__mro_entries__ -typing.NoExtraItems typing.ParamSpec.__mro_entries__ typing.ParamSpecArgs.__mro_entries__ typing.ParamSpecKwargs.__mro_entries__ typing.SupportsAbs.__type_params__ typing.SupportsRound.__type_params__ -typing.TypeAliasType.__qualname__ -typing.TypeForm typing.TypeVar.__mro_entries__ -typing.TypeVarTuple.__bound__ -typing.TypeVarTuple.__contravariant__ -typing.TypeVarTuple.__covariant__ -typing.TypeVarTuple.__infer_variance__ typing.TypeVarTuple.__mro_entries__ typing.Union typing._SpecialForm.__mro_entries__ -typing.__all__ -typing.disjoint_base -typing.no_type_check_decorator +typing_extensions.__all__ typing_extensions.Protocol unicodedata.block unicodedata.extended_pictographic diff --git a/stdlib/_collections_abc.pyi b/stdlib/_collections_abc.pyi index 62e059da5916..6fc32078532e 100644 --- a/stdlib/_collections_abc.pyi +++ b/stdlib/_collections_abc.pyi @@ -60,8 +60,9 @@ __all__ = [ "ValuesView", "Sequence", "MutableSequence", - "ByteString", ] +if sys.version_info < (3, 15): + __all__ += ["ByteString"] if sys.version_info >= (3, 12): __all__ += ["Buffer"] diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 5173991d5d20..6db0e3852f9b 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -39,7 +39,6 @@ __all__ = [ "AsyncIterator", "Awaitable", "BinaryIO", - "ByteString", "Callable", "ChainMap", "ClassVar", @@ -110,14 +109,19 @@ __all__ = [ "get_type_hints", "is_typeddict", "no_type_check", - "no_type_check_decorator", "overload", "runtime_checkable", ] +if sys.version_info < (3, 15): + __all__ += ["ByteString", "no_type_check_decorator"] + if sys.version_info >= (3, 14): __all__ += ["evaluate_forward_ref"] +if sys.version_info >= (3, 15): + __all__ += ["NoExtraItems", "TypeForm", "disjoint_base"] + if sys.version_info >= (3, 11): __all__ += [ "LiteralString", @@ -258,11 +262,31 @@ if sys.version_info >= (3, 11): class TypeVarTuple: @property def __name__(self) -> str: ... + if sys.version_info >= (3, 15): + @property + def __bound__(self) -> Any | None: ... # AnnotationForm + @property + def __covariant__(self) -> bool: ... + @property + def __contravariant__(self) -> bool: ... + @property + def __infer_variance__(self) -> bool: ... if sys.version_info >= (3, 13): @property def __default__(self) -> Any: ... # AnnotationForm def has_default(self) -> bool: ... - if sys.version_info >= (3, 13): + if sys.version_info >= (3, 15): + def __new__( + cls, + name: str, + *, + bound: Any | None = None, # AnnotationForm + covariant: bool = False, + contravariant: bool = False, + default: Any = ..., # AnnotationForm + infer_variance: bool = False, + ) -> Self: ... + elif sys.version_info >= (3, 13): def __new__(cls, name: str, *, default: Any = ...) -> Self: ... # AnnotationForm elif sys.version_info >= (3, 12): def __new__(cls, name: str) -> Self: ... @@ -397,12 +421,16 @@ _TC = TypeVar("_TC", bound=type[object]) def overload(func: _F) -> _F: ... def no_type_check(arg: _F) -> _F: ... -if sys.version_info >= (3, 13): - @deprecated("Deprecated since Python 3.13; removed in Python 3.15.") - def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... +if sys.version_info < (3, 15): + if sys.version_info >= (3, 13): + @deprecated("Deprecated since Python 3.13; removed in Python 3.15.") + def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... -else: - def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... + else: + def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... + +if sys.version_info >= (3, 15): + def disjoint_base(cls: _TC) -> _TC: ... # This itself is only available during type checking def type_check_only(func_or_cls: _FT) -> _FT: ... @@ -426,6 +454,13 @@ ChainMap = _Alias() OrderedDict = _Alias() Annotated: _SpecialForm +if sys.version_info >= (3, 15): + @type_check_only + class _NoExtraItemsType: ... + + NoExtraItems: _NoExtraItemsType + + TypeForm: _SpecialForm # Predefined type variables. AnyStr = TypeVar("AnyStr", str, bytes) # noqa: Y001 @@ -1147,6 +1182,9 @@ if sys.version_info >= (3, 12): def __parameters__(self) -> tuple[Any, ...]: ... # AnnotationForm @property def __name__(self) -> str: ... + if sys.version_info >= (3, 15): + @property + def __qualname__(self) -> str: ... # It's writable on types, but not on instances of TypeAliasType. @property def __module__(self) -> str | None: ... # type: ignore[override] diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index db679983b02b..ef0da9ff358f 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -68,7 +68,6 @@ from typing import ( # noqa: Y022,Y037,Y038,Y039,UP035 cast as cast, is_typeddict as is_typeddict, no_type_check as no_type_check, - no_type_check_decorator as no_type_check_decorator, overload as overload, type_check_only, ) @@ -210,6 +209,9 @@ _TC = _TypeVar("_TC", bound=type[object]) _T_co = _TypeVar("_T_co", covariant=True) # Any type covariant containers. _T_contra = _TypeVar("_T_contra", contravariant=True) +if sys.version_info < (3, 15): + def no_type_check_decorator(decorator: _F) -> _F: ... + # Do not import (and re-export) Protocol or runtime_checkable from # typing module because type checkers need to be able to distinguish # typing.Protocol and typing_extensions.Protocol so they can properly