From 7413c8fb4f983ded14e96857d4da5ed7a5c82b46 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Sun, 19 Feb 2017 20:39:19 +0300 Subject: [PATCH 1/2] Missing special attributes of class instances inherited from object --- stdlib/2/__builtin__.pyi | 3 +++ stdlib/3/builtins.pyi | 3 +++ 2 files changed, 6 insertions(+) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 59b01e58a738..31e0e8d7a4d5 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -31,6 +31,7 @@ class object: __doc__ = ... # type: Optional[str] __class__ = ... # type: type __slots__ = ... # type: Optional[Union[str, unicode, Iterable[Union[str, unicode]]]] + __module__ = ... # type: str def __init__(self) -> None: ... def __new__(cls) -> Any: ... @@ -44,6 +45,8 @@ class object: def __getattribute__(self, name: str) -> Any: ... def __delattr__(self, name: str) -> None: ... def __sizeof__(self) -> int: ... + def __reduce__(self) -> Union[str, tuple]: ... + def __reduce_ex__(self, protocol: int) -> Union[str, tuple]: ... class type(object): __bases__ = ... # type: Tuple[type, ...] diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index 3c82247a6ae6..43113c865567 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -34,6 +34,7 @@ class object: __class__ = ... # type: type __dict__ = ... # type: Dict[str, Any] __slots__ = ... # type: Optional[Union[str, Iterable[str]]] + __module__ = ... # type: str def __init__(self) -> None: ... def __new__(cls) -> Any: ... @@ -47,6 +48,8 @@ class object: def __getattribute__(self, name: str) -> Any: ... def __delattr__(self, name: str) -> None: ... def __sizeof__(self) -> int: ... + def __reduce__(self) -> Union[str, tuple]: ... + def __reduce_ex__(self, protocol: int) -> Union[str, tuple]: ... if sys.version_info >= (3, 6): def __init_subclass__(cls) -> None: ... From 2bc1a09e6a79fe04e826a912f95268261ec8b151 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Mon, 20 Feb 2017 22:39:16 +0300 Subject: [PATCH 2/2] object.__reduce__ returns a tuple It's up to its inheritors to return either a tuple or a string. --- stdlib/2/__builtin__.pyi | 4 ++-- stdlib/3/builtins.pyi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 31e0e8d7a4d5..5e4fd8f8dbff 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -45,8 +45,8 @@ class object: def __getattribute__(self, name: str) -> Any: ... def __delattr__(self, name: str) -> None: ... def __sizeof__(self) -> int: ... - def __reduce__(self) -> Union[str, tuple]: ... - def __reduce_ex__(self, protocol: int) -> Union[str, tuple]: ... + def __reduce__(self) -> tuple: ... + def __reduce_ex__(self, protocol: int) -> tuple: ... class type(object): __bases__ = ... # type: Tuple[type, ...] diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index 43113c865567..8697b1a9c63b 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -48,8 +48,8 @@ class object: def __getattribute__(self, name: str) -> Any: ... def __delattr__(self, name: str) -> None: ... def __sizeof__(self) -> int: ... - def __reduce__(self) -> Union[str, tuple]: ... - def __reduce_ex__(self, protocol: int) -> Union[str, tuple]: ... + def __reduce__(self) -> tuple: ... + def __reduce_ex__(self, protocol: int) -> tuple: ... if sys.version_info >= (3, 6): def __init_subclass__(cls) -> None: ...