From 9811adc11d314420d6e3d451783f453e68c0f572 Mon Sep 17 00:00:00 2001 From: MSeifert04 Date: Sun, 10 Nov 2019 14:50:04 +0100 Subject: [PATCH] Change the return type of __reduce__ and __reduce_ex__ to Union[str, Tuple[Any, ...]] This allows subclasses to return strings (which are allowed) from these methods without having mypy throwing an error. --- stdlib/2/__builtin__.pyi | 4 ++-- stdlib/2and3/builtins.pyi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index f044b4a341d7..af95e6b8fb9e 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -61,8 +61,8 @@ class object: def __getattribute__(self, name: str) -> Any: ... def __delattr__(self, name: str) -> None: ... def __sizeof__(self) -> int: ... - def __reduce__(self) -> Tuple[Any, ...]: ... - def __reduce_ex__(self, protocol: int) -> Tuple[Any, ...]: ... + def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ... + def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ... if sys.version_info >= (3,): def __dir__(self) -> Iterable[str]: ... if sys.version_info >= (3, 6): diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index f044b4a341d7..af95e6b8fb9e 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -61,8 +61,8 @@ class object: def __getattribute__(self, name: str) -> Any: ... def __delattr__(self, name: str) -> None: ... def __sizeof__(self) -> int: ... - def __reduce__(self) -> Tuple[Any, ...]: ... - def __reduce_ex__(self, protocol: int) -> Tuple[Any, ...]: ... + def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ... + def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ... if sys.version_info >= (3,): def __dir__(self) -> Iterable[str]: ... if sys.version_info >= (3, 6):