Issue #27989: Tweak inspect.formatannotation() to improve pydoc rendering of function annotations. Ivan L.
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 @@
     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__