Skip to content

Commit 1ec2387

Browse files
authored
Fix 'object.__reduce__' (#6662)
Reverts regressions introduced by #6292. Fixes #6661.
1 parent 40f2cb6 commit 1ec2387

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

stdlib/builtins.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ class object:
106106
def __getattribute__(self, __name: str) -> Any: ...
107107
def __delattr__(self, __name: str) -> None: ...
108108
def __sizeof__(self) -> int: ...
109-
def __reduce__(self) -> str | Tuple[object, ...]: ...
109+
# return type of pickle methods is rather hard to express in the current type system
110+
# see #6661 and https://docs.python.org/3/library/pickle.html#object.__reduce__
111+
def __reduce__(self) -> str | Tuple[Any, ...]: ...
110112
if sys.version_info >= (3, 8):
111-
def __reduce_ex__(self, __protocol: SupportsIndex) -> str | Tuple[object, ...]: ...
113+
def __reduce_ex__(self, __protocol: SupportsIndex) -> str | Tuple[Any, ...]: ...
112114
else:
113-
def __reduce_ex__(self, __protocol: int) -> str | Tuple[object, ...]: ...
115+
def __reduce_ex__(self, __protocol: int) -> str | Tuple[Any, ...]: ...
114116
def __dir__(self) -> Iterable[str]: ...
115117
def __init_subclass__(cls) -> None: ...
116118

0 commit comments

Comments
 (0)