summaryrefslogtreecommitdiffstats
path: root/Lib/typing.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/typing.py')
-rw-r--r--Lib/typing.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index bd30da9..69f6d98 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -1234,7 +1234,11 @@ def get_type_hints(obj, globalns=None, localns=None):
if isinstance(obj, types.ModuleType):
globalns = obj.__dict__
else:
- globalns = getattr(obj, '__globals__', {})
+ nsobj = obj
+ # Find globalns for the unwrapped object.
+ while hasattr(nsobj, '__wrapped__'):
+ nsobj = nsobj.__wrapped__
+ globalns = getattr(nsobj, '__globals__', {})
if localns is None:
localns = globalns
elif localns is None: