Skip to content

Commit 1c6ac09

Browse files
authored
Add EllipsisType, NoneType, and NotImplementedType (Python 3.10) (#4822)
1 parent e5d3a47 commit 1c6ac09

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

stdlib/2and3/_typeshed/__init__.pyi

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ else:
170170
ReadableBuffer = Union[bytes, bytearray, memoryview, array.array, mmap.mmap, buffer]
171171
WriteableBuffer = Union[bytearray, memoryview, array.array, mmap.mmap, buffer]
172172

173-
# Used by type checkers for checks involving None (does not exist at runtime)
174-
@final
175-
class NoneType:
176-
def __bool__(self) -> Literal[False]: ...
173+
if sys.version_info >= (3, 10):
174+
from types import NoneType as NoneType
175+
else:
176+
# Used by type checkers for checks involving None (does not exist at runtime)
177+
@final
178+
class NoneType:
179+
def __bool__(self) -> Literal[False]: ...

stdlib/3/types.pyi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ from typing import (
1515
Union,
1616
overload,
1717
)
18+
from typing_extensions import Literal, final
1819

1920
# ModuleType is exported from this module, but for circular import
2021
# reasons exists in its own stub file (with ModuleSpec and Loader).
@@ -324,3 +325,10 @@ if sys.version_info >= (3, 9):
324325
__parameters__: Tuple[Any, ...]
325326
def __init__(self, origin: type, args: Any) -> None: ...
326327
def __getattr__(self, name: str) -> Any: ... # incomplete
328+
329+
if sys.version_info >= (3, 10):
330+
@final
331+
class NoneType:
332+
def __bool__(self) -> Literal[False]: ...
333+
EllipsisType = ellipsis # noqa F811 from builtins
334+
NotImplementedType = _NotImplementedType # noqa F811 from builtins

0 commit comments

Comments
 (0)