mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-44468: Never skip base classes in typing.get_type_hints()
, even with invalid .__module__
. (GH-26862)
This commit is contained in:
parent
521ba8892e
commit
7569c0fe91
3 changed files with 21 additions and 11 deletions
|
@ -1701,10 +1701,7 @@ def get_type_hints(obj, globalns=None, localns=None, include_extras=False):
|
|||
hints = {}
|
||||
for base in reversed(obj.__mro__):
|
||||
if globalns is None:
|
||||
try:
|
||||
base_globals = sys.modules[base.__module__].__dict__
|
||||
except KeyError:
|
||||
continue
|
||||
base_globals = getattr(sys.modules.get(base.__module__, None), '__dict__', {})
|
||||
else:
|
||||
base_globals = globalns
|
||||
ann = base.__dict__.get('__annotations__', {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue