Skip to content

Commit 27d2c22

Browse files
authored
[0.931 backport] Fix __reduce__ regression (#11866)
Co-authored-by: hauntsaninja <>
1 parent 06afa7c commit 27d2c22

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mypy/typeshed/stdlib/builtins.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ class object:
100100
def __getattribute__(self, __name: str) -> Any: ...
101101
def __delattr__(self, __name: str) -> None: ...
102102
def __sizeof__(self) -> int: ...
103-
def __reduce__(self) -> str | Tuple[object, ...]: ...
103+
# return type of pickle methods is rather hard to express in the current type system
104+
# see #6661 and https://docs.python.org/3/library/pickle.html#object.__reduce__
105+
def __reduce__(self) -> str | Tuple[Any, ...]: ...
104106
if sys.version_info >= (3, 8):
105-
def __reduce_ex__(self, __protocol: SupportsIndex) -> str | Tuple[object, ...]: ...
107+
def __reduce_ex__(self, __protocol: SupportsIndex) -> str | Tuple[Any, ...]: ...
106108
else:
107-
def __reduce_ex__(self, __protocol: int) -> str | Tuple[object, ...]: ...
109+
def __reduce_ex__(self, __protocol: int) -> str | Tuple[Any, ...]: ...
108110
def __dir__(self) -> Iterable[str]: ...
109111
def __init_subclass__(cls) -> None: ...
110112

0 commit comments

Comments
 (0)