bpo-44524: Add missed __name__ and __qualname__ to typing module objects (GH-27237) (#27246)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit bce1418541a64a793960182772f985f64afbfa1a)

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
diff --git a/Lib/typing.py b/Lib/typing.py
index 660ad35..cb70394 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -357,6 +357,12 @@ def __init__(self, getitem):
         self._name = getitem.__name__
         self.__doc__ = getitem.__doc__
 
+    def __getattr__(self, item):
+        if item in {'__name__', '__qualname__'}:
+            return self._name
+
+        raise AttributeError(item)
+
     def __mro_entries__(self, bases):
         raise TypeError(f"Cannot subclass {self!r}")
 
@@ -934,6 +940,9 @@ def __mro_entries__(self, bases):
         return tuple(res)
 
     def __getattr__(self, attr):
+        if attr in {'__name__', '__qualname__'}:
+            return self._name
+
         # We are careful for copy and pickle.
         # Also for simplicity we just don't relay all dunder names
         if '__origin__' in self.__dict__ and not _is_dunder(attr):