summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2016-10-22 14:55:18 (GMT)
committerGuido van Rossum <guido@python.org>2016-10-22 14:55:18 (GMT)
commit52e5004b59d89e5f1bf2ceaba0d2c9e63368454b (patch)
treeca181df1676c03561a69d34285b4d9b1d0a0d525 /Lib/inspect.py
parent1002a621c1f0c8d5adcdd6462b9bdd0470e34290 (diff)
downloadcpython-52e5004b59d89e5f1bf2ceaba0d2c9e63368454b.zip
cpython-52e5004b59d89e5f1bf2ceaba0d2c9e63368454b.tar.gz
cpython-52e5004b59d89e5f1bf2ceaba0d2c9e63368454b.tar.bz2
Issue #27989: Tweak inspect.formatannotation() to improve pydoc rendering of function annotations. Ivan L.
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 ca1d551..0fd0382 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1152,6 +1152,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__