summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2016-10-22 14:57:24 (GMT)
committerGuido van Rossum <guido@python.org>2016-10-22 14:57:24 (GMT)
commitf25bf43d166bc39f756d3942f0d7675963459ed8 (patch)
treef97564495637a31db3902594a3d0dd2b063d24ac /Lib/inspect.py
parentf1f9b633ac39f6886ff5012355c9dc8080a28c94 (diff)
parent265dce6cbbe700183228632f16bc1d4a2683c935 (diff)
downloadcpython-f25bf43d166bc39f756d3942f0d7675963459ed8.zip
cpython-f25bf43d166bc39f756d3942f0d7675963459ed8.tar.gz
cpython-f25bf43d166bc39f756d3942f0d7675963459ed8.tar.bz2
Issue #27989: Tweak inspect.formatannotation() to improve pydoc rendering of function annotations. Ivan L. (3.6->3.7)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 2380095..2923d6d 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1140,6 +1140,8 @@ def getargvalues(frame):
return ArgInfo(args, varargs, varkw, frame.f_locals)
def formatannotation(annotation, base_module=None):
+ if getattr(annotation, '__module__', None) == 'typing':
+ return repr(annotation).replace('typing.', '')
if isinstance(annotation, type):
if annotation.__module__ in ('builtins', base_module):
return annotation.__qualname__