Skip to content

Commit 97ecd2b

Browse files
MSeifert04srittau
authored andcommitted
Change the return type of __reduce__ and __reduce_ex__ to Union[str, Tuple[Any, ...]] (#3453)
This allows subclasses to return strings (which are allowed) from these methods without having mypy throwing an error. Closes #3452
1 parent d60b7ae commit 97ecd2b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

stdlib/2/__builtin__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ class object:
6161
def __getattribute__(self, name: str) -> Any: ...
6262
def __delattr__(self, name: str) -> None: ...
6363
def __sizeof__(self) -> int: ...
64-
def __reduce__(self) -> Tuple[Any, ...]: ...
65-
def __reduce_ex__(self, protocol: int) -> Tuple[Any, ...]: ...
64+
def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ...
65+
def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ...
6666
if sys.version_info >= (3,):
6767
def __dir__(self) -> Iterable[str]: ...
6868
if sys.version_info >= (3, 6):

stdlib/2and3/builtins.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ class object:
6161
def __getattribute__(self, name: str) -> Any: ...
6262
def __delattr__(self, name: str) -> None: ...
6363
def __sizeof__(self) -> int: ...
64-
def __reduce__(self) -> Tuple[Any, ...]: ...
65-
def __reduce_ex__(self, protocol: int) -> Tuple[Any, ...]: ...
64+
def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ...
65+
def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ...
6666
if sys.version_info >= (3,):
6767
def __dir__(self) -> Iterable[str]: ...
6868
if sys.version_info >= (3, 6):

0 commit comments

Comments
 (0)