bpo-37838: get_type_hints for wrapped functions with forward reference (GH-17126)

https://bugs.python.org/issue37838
diff --git a/Lib/test/ann_module.py b/Lib/test/ann_module.py
index 9e6b87d..0567d6d 100644
--- a/Lib/test/ann_module.py
+++ b/Lib/test/ann_module.py
@@ -6,6 +6,7 @@
 """
 
 from typing import Optional
+from functools import wraps
 
 __annotations__[1] = 2
 
@@ -51,3 +52,9 @@
     def bar(y: List[str]):
         x: str = 'yes'
     bar()
+
+def dec(func):
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        return func(*args, **kwargs)
+    return wrapper
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 49417ef..ccd617c 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -2778,6 +2778,16 @@
 
 gth = get_type_hints
 
+class ForRefExample:
+    @ann_module.dec
+    def func(self: 'ForRefExample'):
+        pass
+
+    @ann_module.dec
+    @ann_module.dec
+    def nested(self: 'ForRefExample'):
+        pass
+
 
 class GetTypeHintTests(BaseTestCase):
     def test_get_type_hints_from_various_objects(self):
@@ -2876,6 +2886,11 @@
                           'x': ClassVar[Optional[B]]})
         self.assertEqual(gth(G), {'lst': ClassVar[List[T]]})
 
+    def test_get_type_hints_wrapped_decoratored_func(self):
+        expects = {'self': ForRefExample}
+        self.assertEqual(gth(ForRefExample.func), expects)
+        self.assertEqual(gth(ForRefExample.nested), expects)
+
 
 class GetUtilitiesTestCase(TestCase):
     def test_get_origin(self):