Skip to content

Commit be85cc7

Browse files
builtins: updates for py312 (#10211)
Co-authored-by: AlexWaygood <[email protected]>
1 parent d8ef303 commit be85cc7

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

stdlib/builtins.pyi

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,18 @@ from typing import ( # noqa: Y022
5353
overload,
5454
type_check_only,
5555
)
56-
from typing_extensions import Concatenate, Literal, LiteralString, ParamSpec, Self, SupportsIndex, TypeAlias, TypeGuard, final
56+
from typing_extensions import (
57+
Concatenate,
58+
Literal,
59+
LiteralString,
60+
ParamSpec,
61+
Self,
62+
SupportsIndex,
63+
TypeAlias,
64+
TypeGuard,
65+
TypeVarTuple,
66+
final,
67+
)
5768

5869
if sys.version_info >= (3, 9):
5970
from types import GenericAlias
@@ -187,6 +198,8 @@ class type:
187198
if sys.version_info >= (3, 10):
188199
def __or__(self, __value: Any) -> types.UnionType: ...
189200
def __ror__(self, __value: Any) -> types.UnionType: ...
201+
if sys.version_info >= (3, 12):
202+
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
190203

191204
class super:
192205
@overload
@@ -244,6 +257,9 @@ class int:
244257
signed: bool = False,
245258
) -> Self: ...
246259

260+
if sys.version_info >= (3, 12):
261+
def is_integer(self) -> Literal[True]: ...
262+
247263
def __add__(self, __value: int) -> int: ...
248264
def __sub__(self, __value: int) -> int: ...
249265
def __mul__(self, __value: int) -> int: ...
@@ -966,6 +982,8 @@ class function:
966982
if sys.version_info >= (3, 10):
967983
@property
968984
def __builtins__(self) -> dict[str, Any]: ...
985+
if sys.version_info >= (3, 12):
986+
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
969987

970988
__module__: str
971989
# mypy uses `builtins.function.__get__` to represent methods, properties, and getset_descriptors so we type the return as Any.
@@ -1918,6 +1936,8 @@ class ImportError(Exception):
19181936
name: str | None
19191937
path: str | None
19201938
msg: str # undocumented
1939+
if sys.version_info >= (3, 12):
1940+
name_from: str | None # undocumented
19211941

19221942
class LookupError(Exception): ...
19231943
class MemoryError(Exception): ...

stdlib/types.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ from importlib.machinery import ModuleSpec
1717

1818
# pytype crashes if types.MappingProxyType inherits from collections.abc.Mapping instead of typing.Mapping
1919
from typing import Any, ClassVar, Generic, Mapping, Protocol, TypeVar, overload # noqa: Y022
20-
from typing_extensions import Literal, ParamSpec, final
20+
from typing_extensions import Literal, ParamSpec, TypeVarTuple, final
2121

2222
__all__ = [
2323
"FunctionType",
@@ -94,6 +94,8 @@ class FunctionType:
9494
if sys.version_info >= (3, 10):
9595
@property
9696
def __builtins__(self) -> dict[str, Any]: ...
97+
if sys.version_info >= (3, 12):
98+
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
9799

98100
__module__: str
99101
def __init__(

0 commit comments

Comments
 (0)