summaryrefslogtreecommitdiffstats
path: root/Lib/typing.py
diff options
context:
space:
mode:
authorSebastian Rittau <srittau@rittau.biz>2021-07-06 15:01:15 (GMT)
committerGitHub <noreply@github.com>2021-07-06 15:01:15 (GMT)
commit8b849ea0f3482ad834e7989ff474dd5db2f295c8 (patch)
treef850475382463652ef3f47974346b61738ee138f /Lib/typing.py
parentf64de53ff01e734d48d1d42195443d7d1646f220 (diff)
downloadcpython-8b849ea0f3482ad834e7989ff474dd5db2f295c8.zip
cpython-8b849ea0f3482ad834e7989ff474dd5db2f295c8.tar.gz
cpython-8b849ea0f3482ad834e7989ff474dd5db2f295c8.tar.bz2
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__.
Diffstat (limited to 'Lib/typing.py')
-rw-r--r--Lib/typing.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index 2287f05..ca05fb5 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -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 "