Skip to content

Commit 9430260

Browse files
builtins: improve builtins.function (#14094)
Remove two differences from types.FunctionType that should be safe to clean up.
1 parent 39f53a0 commit 9430260

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

stdlib/builtins.pyi

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,14 +1028,34 @@ class function:
10281028
__annotations__: dict[str, AnnotationForm]
10291029
if sys.version_info >= (3, 14):
10301030
__annotate__: AnnotateFunc | None
1031-
__kwdefaults__: dict[str, Any]
1031+
__kwdefaults__: dict[str, Any] | None
10321032
if sys.version_info >= (3, 10):
10331033
@property
10341034
def __builtins__(self) -> dict[str, Any]: ...
10351035
if sys.version_info >= (3, 12):
10361036
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
10371037

10381038
__module__: str
1039+
if sys.version_info >= (3, 13):
1040+
def __new__(
1041+
cls,
1042+
code: CodeType,
1043+
globals: dict[str, Any],
1044+
name: str | None = None,
1045+
argdefs: tuple[object, ...] | None = None,
1046+
closure: tuple[CellType, ...] | None = None,
1047+
kwdefaults: dict[str, object] | None = None,
1048+
) -> Self: ...
1049+
else:
1050+
def __new__(
1051+
cls,
1052+
code: CodeType,
1053+
globals: dict[str, Any],
1054+
name: str | None = None,
1055+
argdefs: tuple[object, ...] | None = None,
1056+
closure: tuple[CellType, ...] | None = None,
1057+
) -> Self: ...
1058+
10391059
# mypy uses `builtins.function.__get__` to represent methods, properties, and getset_descriptors so we type the return as Any.
10401060
def __get__(self, instance: object, owner: type | None = None, /) -> Any: ...
10411061

0 commit comments

Comments
 (0)