diff options
author | Guido van Rossum <guido@python.org> | 2016-10-22 07:56:58 -0700 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2016-10-22 07:56:58 -0700 |
commit | 265dce6cbbe700183228632f16bc1d4a2683c935 (patch) | |
tree | cee83144b0efb42fe0b077c25ef3c9a061a2c481 /Lib/inspect.py | |
parent | 85e81cfe9b51ff59a2065b5863d831ee7cb72b12 (diff) | |
parent | 52e5004b59d89e5f1bf2ceaba0d2c9e63368454b (diff) | |
download | cpython-git-265dce6cbbe700183228632f16bc1d4a2683c935.tar.gz |
Issue #27989: Tweak inspect.formatannotation() to improve pydoc rendering of function annotations. Ivan L. (3.5->3.6)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 2380095e76..2923d6dacc 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__ |