Blame SOURCES/768.patch

018433
From 1913db5ae20e95e636471cc79208330dfe7a1d72 Mon Sep 17 00:00:00 2001
018433
From: Noel Evans <noelevans@gmail.com>
018433
Date: Wed, 25 Nov 2020 22:09:44 +0000
018433
Subject: [PATCH 1/3] Fix tests failing with 3.10.0a2+
018433
018433
---
018433
 .../src_py3/test_typing_extensions.py         | 39 ++++++++++++++++---
018433
 1 file changed, 33 insertions(+), 6 deletions(-)
018433
018433
diff --git a/typing_extensions/src_py3/test_typing_extensions.py b/typing_extensions/src_py3/test_typing_extensions.py
018433
index 0222303..89c3037 100644
018433
--- a/typing_extensions/src_py3/test_typing_extensions.py
018433
+++ b/typing_extensions/src_py3/test_typing_extensions.py
018433
@@ -9,7 +9,7 @@
018433
 from unittest import TestCase, main, skipUnless, skipIf
018433
 from typing import TypeVar, Optional
018433
 from typing import T, KT, VT  # Not in __all__.
018433
-from typing import Tuple, List, Dict, Iterator
018433
+from typing import ForwardRef, Tuple, List, Dict, Iterator
018433
 from typing import Generic
018433
 from typing import no_type_check
018433
 from typing_extensions import NoReturn, ClassVar, Final, IntVar, Literal, Type, NewType, TypedDict
018433
@@ -71,6 +71,9 @@
018433
 # For checks reliant on Python 3.6 syntax changes (e.g. classvar)
018433
 PY36 = sys.version_info[:2] >= (3, 6)
018433
 
018433
+# For checks reliant on Python 3.10
018433
+PY3_10 = sys.version_info[:2] >= (3, 10)
018433
+
018433
 # Protocols are hard to backport to the original version of typing 3.5.0
018433
 HAVE_PROTOCOLS = sys.version_info[:3] != (3, 5, 0)
018433
 
018433
@@ -1516,7 +1519,6 @@ def test_typeddict_errors(self):
018433
     def test_py36_class_syntax_usage(self):
018433
         self.assertEqual(LabelPoint2D.__name__, 'LabelPoint2D')
018433
         self.assertEqual(LabelPoint2D.__module__, __name__)
018433
-        self.assertEqual(LabelPoint2D.__annotations__, {'x': int, 'y': int, 'label': str})
018433
         self.assertEqual(LabelPoint2D.__bases__, (dict,))
018433
         self.assertEqual(LabelPoint2D.__total__, True)
018433
         self.assertNotIsSubclass(LabelPoint2D, typing.Sequence)
018433
@@ -1525,6 +1527,13 @@ def test_py36_class_syntax_usage(self):
018433
         self.assertEqual(not_origin['y'], 1)
018433
         other = LabelPoint2D(x=0, y=1, label='hi')
018433
         self.assertEqual(other['label'], 'hi')
018433
+        if PY3_10:
018433
+            self.assertEqual(LabelPoint2D.__annotations__, {
018433
+                'x': ForwardRef('int'),
018433
+                'y': ForwardRef('int'),
018433
+                'label': str})
018433
+        else:
018433
+            self.assertEqual(LabelPoint2D.__annotations__, {'x': int, 'y': int, 'label': str})
018433
 
018433
     def test_pickle(self):
018433
         global EmpD  # pickle wants to reference the class by name
018433
@@ -1565,18 +1574,21 @@ def test_optional_keys(self):
018433
     def test_keys_inheritance(self):
018433
         assert BaseAnimal.__required_keys__ == frozenset(['name'])
018433
         assert BaseAnimal.__optional_keys__ == frozenset([])
018433
-        assert BaseAnimal.__annotations__ == {'name': str}
018433
 
018433
         assert Animal.__required_keys__ == frozenset(['name'])
018433
         assert Animal.__optional_keys__ == frozenset(['tail', 'voice'])
018433
+
018433
+        assert Cat.__required_keys__ == frozenset(['name', 'fur_color'])
018433
+        assert Cat.__optional_keys__ == frozenset(['tail', 'voice'])
018433
+
018433
+    @skipUnless(PY36 and not PY3_10, 'Python 3.6 and < 3.10 required')
018433
+    def test_keys_inheritance_before_postponed_annotation_eval(self):
018433
+        assert BaseAnimal.__annotations__ == {'name': str}
018433
         assert Animal.__annotations__ == {
018433
             'name': str,
018433
             'tail': bool,
018433
             'voice': str,
018433
         }
018433
-
018433
-        assert Cat.__required_keys__ == frozenset(['name', 'fur_color'])
018433
-        assert Cat.__optional_keys__ == frozenset(['tail', 'voice'])
018433
         assert Cat.__annotations__ == {
018433
             'fur_color': str,
018433
             'name': str,
018433
@@ -1584,6 +1596,21 @@ def test_keys_inheritance(self):
018433
             'voice': str,
018433
         }
018433
 
018433
+    @skipUnless(PY3_10, 'Python 3.10 required')
018433
+    def test_keys_inheritance_with_postponed_annotation_eval(self):
018433
+        assert BaseAnimal.__annotations__ == {'name': ForwardRef('str')}
018433
+        assert Animal.__annotations__ == {
018433
+            'name': ForwardRef('str'),
018433
+            'tail': ForwardRef('bool'),
018433
+            'voice': ForwardRef('str'),
018433
+        }
018433
+        assert Cat.__annotations__ == {
018433
+            'fur_color': ForwardRef('str'),
018433
+            'name': ForwardRef('str'),
018433
+            'tail': ForwardRef('bool'),
018433
+            'voice': ForwardRef('str'),
018433
+        }
018433
+
018433
 
018433
 @skipUnless(TYPING_3_5_3, "Python >= 3.5.3 required")
018433
 class AnnotatedTests(BaseTestCase):
018433
018433
From a6b50a9788cb071ff11c408a7212bef1bad9b233 Mon Sep 17 00:00:00 2001
018433
From: Noel Evans <noelevans@gmail.com>
018433
Date: Wed, 25 Nov 2020 22:34:12 +0000
018433
Subject: [PATCH 2/3] Fix import issue
018433
018433
---
018433
 .../src_py3/test_typing_extensions.py         | 24 +++++++++----------
018433
 1 file changed, 12 insertions(+), 12 deletions(-)
018433
018433
diff --git a/typing_extensions/src_py3/test_typing_extensions.py b/typing_extensions/src_py3/test_typing_extensions.py
018433
index 89c3037..1c02877 100644
018433
--- a/typing_extensions/src_py3/test_typing_extensions.py
018433
+++ b/typing_extensions/src_py3/test_typing_extensions.py
018433
@@ -9,7 +9,7 @@
018433
 from unittest import TestCase, main, skipUnless, skipIf
018433
 from typing import TypeVar, Optional
018433
 from typing import T, KT, VT  # Not in __all__.
018433
-from typing import ForwardRef, Tuple, List, Dict, Iterator
018433
+from typing import Tuple, List, Dict, Iterator
018433
 from typing import Generic
018433
 from typing import no_type_check
018433
 from typing_extensions import NoReturn, ClassVar, Final, IntVar, Literal, Type, NewType, TypedDict
018433
@@ -35,7 +35,7 @@
018433
 
018433
 OLD_GENERICS = False
018433
 try:
018433
-    from typing import _type_vars, _next_in_mro, _type_check  # noqa
018433
+    from typing import _type_vars, _next_in_mro, _type_check # noqa
018433
 except ImportError:
018433
     OLD_GENERICS = True
018433
 
018433
@@ -1529,8 +1529,8 @@ def test_py36_class_syntax_usage(self):
018433
         self.assertEqual(other['label'], 'hi')
018433
         if PY3_10:
018433
             self.assertEqual(LabelPoint2D.__annotations__, {
018433
-                'x': ForwardRef('int'),
018433
-                'y': ForwardRef('int'),
018433
+                'x': typing.ForwardRef('int'),
018433
+                'y': typing.ForwardRef('int'),
018433
                 'label': str})
018433
         else:
018433
             self.assertEqual(LabelPoint2D.__annotations__, {'x': int, 'y': int, 'label': str})
018433
@@ -1598,17 +1598,17 @@ def test_keys_inheritance_before_postponed_annotation_eval(self):
018433
 
018433
     @skipUnless(PY3_10, 'Python 3.10 required')
018433
     def test_keys_inheritance_with_postponed_annotation_eval(self):
018433
-        assert BaseAnimal.__annotations__ == {'name': ForwardRef('str')}
018433
+        assert BaseAnimal.__annotations__ == {'name': typing.ForwardRef('str')}
018433
         assert Animal.__annotations__ == {
018433
-            'name': ForwardRef('str'),
018433
-            'tail': ForwardRef('bool'),
018433
-            'voice': ForwardRef('str'),
018433
+            'name': typing.ForwardRef('str'),
018433
+            'tail': typing.ForwardRef('bool'),
018433
+            'voice': typing.ForwardRef('str'),
018433
         }
018433
         assert Cat.__annotations__ == {
018433
-            'fur_color': ForwardRef('str'),
018433
-            'name': ForwardRef('str'),
018433
-            'tail': ForwardRef('bool'),
018433
-            'voice': ForwardRef('str'),
018433
+            'fur_color': typing.ForwardRef('str'),
018433
+            'name': typing.ForwardRef('str'),
018433
+            'tail': typing.ForwardRef('bool'),
018433
+            'voice': typing.ForwardRef('str'),
018433
         }
018433
 
018433
 
018433
018433
From 762584effacd447b23688acf9cbc70e453fd9601 Mon Sep 17 00:00:00 2001
018433
From: Noel Evans <noelevans@gmail.com>
018433
Date: Wed, 25 Nov 2020 23:35:59 +0000
018433
Subject: [PATCH 3/3] Simplify change using get_type_hints
018433
018433
---
018433
 .../src_py3/test_typing_extensions.py         | 43 ++++---------------
018433
 1 file changed, 8 insertions(+), 35 deletions(-)
018433
018433
diff --git a/typing_extensions/src_py3/test_typing_extensions.py b/typing_extensions/src_py3/test_typing_extensions.py
018433
index 1c02877..b89b396 100644
018433
--- a/typing_extensions/src_py3/test_typing_extensions.py
018433
+++ b/typing_extensions/src_py3/test_typing_extensions.py
018433
@@ -35,7 +35,7 @@
018433
 
018433
 OLD_GENERICS = False
018433
 try:
018433
-    from typing import _type_vars, _next_in_mro, _type_check # noqa
018433
+    from typing import _type_vars, _next_in_mro, _type_check  # noqa
018433
 except ImportError:
018433
     OLD_GENERICS = True
018433
 
018433
@@ -71,9 +71,6 @@
018433
 # For checks reliant on Python 3.6 syntax changes (e.g. classvar)
018433
 PY36 = sys.version_info[:2] >= (3, 6)
018433
 
018433
-# For checks reliant on Python 3.10
018433
-PY3_10 = sys.version_info[:2] >= (3, 10)
018433
-
018433
 # Protocols are hard to backport to the original version of typing 3.5.0
018433
 HAVE_PROTOCOLS = sys.version_info[:3] != (3, 5, 0)
018433
 
018433
@@ -1519,6 +1516,7 @@ def test_typeddict_errors(self):
018433
     def test_py36_class_syntax_usage(self):
018433
         self.assertEqual(LabelPoint2D.__name__, 'LabelPoint2D')
018433
         self.assertEqual(LabelPoint2D.__module__, __name__)
018433
+        self.assertEqual(get_type_hints(LabelPoint2D), {'x': int, 'y': int, 'label': str})
018433
         self.assertEqual(LabelPoint2D.__bases__, (dict,))
018433
         self.assertEqual(LabelPoint2D.__total__, True)
018433
         self.assertNotIsSubclass(LabelPoint2D, typing.Sequence)
018433
@@ -1527,13 +1525,6 @@ def test_py36_class_syntax_usage(self):
018433
         self.assertEqual(not_origin['y'], 1)
018433
         other = LabelPoint2D(x=0, y=1, label='hi')
018433
         self.assertEqual(other['label'], 'hi')
018433
-        if PY3_10:
018433
-            self.assertEqual(LabelPoint2D.__annotations__, {
018433
-                'x': typing.ForwardRef('int'),
018433
-                'y': typing.ForwardRef('int'),
018433
-                'label': str})
018433
-        else:
018433
-            self.assertEqual(LabelPoint2D.__annotations__, {'x': int, 'y': int, 'label': str})
018433
 
018433
     def test_pickle(self):
018433
         global EmpD  # pickle wants to reference the class by name
018433
@@ -1574,43 +1565,25 @@ def test_optional_keys(self):
018433
     def test_keys_inheritance(self):
018433
         assert BaseAnimal.__required_keys__ == frozenset(['name'])
018433
         assert BaseAnimal.__optional_keys__ == frozenset([])
018433
+        assert get_type_hints(BaseAnimal) == {'name': str}
018433
 
018433
         assert Animal.__required_keys__ == frozenset(['name'])
018433
         assert Animal.__optional_keys__ == frozenset(['tail', 'voice'])
018433
-
018433
-        assert Cat.__required_keys__ == frozenset(['name', 'fur_color'])
018433
-        assert Cat.__optional_keys__ == frozenset(['tail', 'voice'])
018433
-
018433
-    @skipUnless(PY36 and not PY3_10, 'Python 3.6 and < 3.10 required')
018433
-    def test_keys_inheritance_before_postponed_annotation_eval(self):
018433
-        assert BaseAnimal.__annotations__ == {'name': str}
018433
-        assert Animal.__annotations__ == {
018433
+        assert get_type_hints(Animal) == {
018433
             'name': str,
018433
             'tail': bool,
018433
             'voice': str,
018433
         }
018433
-        assert Cat.__annotations__ == {
018433
+
018433
+        assert Cat.__required_keys__ == frozenset(['name', 'fur_color'])
018433
+        assert Cat.__optional_keys__ == frozenset(['tail', 'voice'])
018433
+        assert get_type_hints(Cat) == {
018433
             'fur_color': str,
018433
             'name': str,
018433
             'tail': bool,
018433
             'voice': str,
018433
         }
018433
 
018433
-    @skipUnless(PY3_10, 'Python 3.10 required')
018433
-    def test_keys_inheritance_with_postponed_annotation_eval(self):
018433
-        assert BaseAnimal.__annotations__ == {'name': typing.ForwardRef('str')}
018433
-        assert Animal.__annotations__ == {
018433
-            'name': typing.ForwardRef('str'),
018433
-            'tail': typing.ForwardRef('bool'),
018433
-            'voice': typing.ForwardRef('str'),
018433
-        }
018433
-        assert Cat.__annotations__ == {
018433
-            'fur_color': typing.ForwardRef('str'),
018433
-            'name': typing.ForwardRef('str'),
018433
-            'tail': typing.ForwardRef('bool'),
018433
-            'voice': typing.ForwardRef('str'),
018433
-        }
018433
-
018433
 
018433
 @skipUnless(TYPING_3_5_3, "Python >= 3.5.3 required")
018433
 class AnnotatedTests(BaseTestCase):