This commit is contained in:
Michael Foord 2011-12-22 01:15:53 +00:00
commit 85530aa1c3
3 changed files with 25 additions and 4 deletions

View file

@ -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)