diff --git a/stdlib/2and3/_typeshed/__init__.pyi b/stdlib/2and3/_typeshed/__init__.pyi index 5e2d72ca8..5e3fe4a10 100644 --- a/stdlib/2and3/_typeshed/__init__.pyi +++ b/stdlib/2and3/_typeshed/__init__.pyi @@ -170,7 +170,10 @@ else: ReadableBuffer = Union[bytes, bytearray, memoryview, array.array, mmap.mmap, buffer] WriteableBuffer = Union[bytearray, memoryview, array.array, mmap.mmap, buffer] -# Used by type checkers for checks involving None (does not exist at runtime) -@final -class NoneType: - def __bool__(self) -> Literal[False]: ... +if sys.version_info >= (3, 10): + from types import NoneType as NoneType +else: + # Used by type checkers for checks involving None (does not exist at runtime) + @final + class NoneType: + def __bool__(self) -> Literal[False]: ... diff --git a/stdlib/3/types.pyi b/stdlib/3/types.pyi index 764dc5bd1..d5b419c17 100644 --- a/stdlib/3/types.pyi +++ b/stdlib/3/types.pyi @@ -15,6 +15,7 @@ from typing import ( Union, overload, ) +from typing_extensions import Literal, final # ModuleType is exported from this module, but for circular import # reasons exists in its own stub file (with ModuleSpec and Loader). @@ -324,3 +325,10 @@ if sys.version_info >= (3, 9): __parameters__: Tuple[Any, ...] def __init__(self, origin: type, args: Any) -> None: ... def __getattr__(self, name: str) -> Any: ... # incomplete + +if sys.version_info >= (3, 10): + @final + class NoneType: + def __bool__(self) -> Literal[False]: ... + EllipsisType = ellipsis # noqa F811 from builtins + NotImplementedType = _NotImplementedType # noqa F811 from builtins