mirror of
https://github.com/python/cpython.git
synced 2025-10-07 15:42:02 +00:00
bpo-38291: Fix a spurious warning when using help(object) (#27039)
help(object) via pydoc.TextDoc.docclass(object) iterates over the subclasses of object, which includes typing.io and typing.re if typing is imported. It tries to access cls.__module__ for each of those sub-classes. This change suppresses warnings when accessing cls.__module__.
This commit is contained in:
parent
f64de53ff0
commit
8b849ea0f3
1 changed files with 1 additions and 1 deletions
|
@ -2512,7 +2512,7 @@ class TextIO(IO[str]):
|
|||
|
||||
class _DeprecatedType(type):
|
||||
def __getattribute__(cls, name):
|
||||
if name != "__dict__" and name in cls.__dict__:
|
||||
if name not in ("__dict__", "__module__") and name in cls.__dict__:
|
||||
warnings.warn(
|
||||
f"{cls.__name__} is deprecated, import directly "
|
||||
f"from typing instead. {cls.__name__} will be removed "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue