[3.6] bpo-28556: Update to typing: treat subscripted generics as proxies (GH-265) (GH-268)

(cherry picked from commit abb3b8ad94d699c8560d94ee9bac9c917b382abe)
(cherry picked from commit 365cb5bb9069273e6970c9d5d17ee2fe5003e7ac)
diff --git a/Lib/typing.py b/Lib/typing.py
index efe358f..9a0f490 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -1158,6 +1158,16 @@
                               self.__parameters__, self.__args__, self.__origin__,
                               self.__extra__, self.__orig_bases__)
 
+    def __setattr__(self, attr, value):
+        # We consider all the subscripted genrics as proxies for original class
+        if (
+            attr.startswith('__') and attr.endswith('__') or
+            attr.startswith('_abc_')
+        ):
+            super(GenericMeta, self).__setattr__(attr, value)
+        else:
+            super(GenericMeta, _gorg(self)).__setattr__(attr, value)
+
 
 # Prevent checks for Generic to crash when defining Generic.
 Generic = None