Skip to content

Commit 6fcd374

Browse files
authored
Move ellipsis definition to types (#11223)
1 parent 6aa6722 commit 6fcd374

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

stdlib/builtins.pyi

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,9 +1914,13 @@ def __import__(
19141914
def __build_class__(__func: Callable[[], _Cell | Any], __name: str, *bases: Any, metaclass: Any = ..., **kwds: Any) -> Any: ...
19151915

19161916
if sys.version_info >= (3, 10):
1917-
# In Python 3.10, EllipsisType is exposed publicly in the types module.
1918-
@final
1919-
class ellipsis: ...
1917+
from types import EllipsisType
1918+
1919+
# Backwards compatibility hack for folks who relied on the ellipsis type
1920+
# existing in typeshed in Python 3.9 and earlier.
1921+
ellipsis = EllipsisType
1922+
1923+
Ellipsis: EllipsisType
19201924

19211925
else:
19221926
# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
@@ -1925,7 +1929,7 @@ else:
19251929
@type_check_only
19261930
class ellipsis: ...
19271931

1928-
Ellipsis: ellipsis
1932+
Ellipsis: ellipsis
19291933

19301934
class BaseException:
19311935
args: tuple[Any, ...]

stdlib/types.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,10 @@ if sys.version_info >= (3, 10):
626626
@final
627627
class NoneType:
628628
def __bool__(self) -> Literal[False]: ...
629-
EllipsisType = ellipsis # noqa: F821 from builtins
629+
630+
@final
631+
class EllipsisType: ...
632+
630633
from builtins import _NotImplementedType
631634

632635
NotImplementedType = _NotImplementedType

0 commit comments

Comments
 (0)