mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-37838: get_type_hints for wrapped functions with forward reference (GH-17126)
https://bugs.python.org/issue37838
This commit is contained in:
parent
82f897bf8f
commit
0aca3a3a1e
4 changed files with 28 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue