mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Merge
This commit is contained in:
commit
85530aa1c3
3 changed files with 25 additions and 4 deletions
|
@ -1186,10 +1186,11 @@ def getattr_static(obj, attr, default=_sentinel):
|
|||
if obj is klass:
|
||||
# for types we check the metaclass too
|
||||
for entry in _static_getmro(type(klass)):
|
||||
try:
|
||||
return entry.__dict__[attr]
|
||||
except KeyError:
|
||||
pass
|
||||
if _shadowed_dict(type(entry)) is _sentinel:
|
||||
try:
|
||||
return entry.__dict__[attr]
|
||||
except KeyError:
|
||||
pass
|
||||
if default is not _sentinel:
|
||||
return default
|
||||
raise AttributeError(attr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue