Merge pull request #2731 from seanfarley/fix-abstractproperty

inspect: return obj.__dict__[name] if there is an exception
This commit is contained in:
Takeshi KOMIYA 2016-07-02 10:22:03 +09:00 committed by GitHub
commit 6227a7f98c

View File

@ -108,6 +108,10 @@ def safe_getattr(obj, name, *defargs):
try:
return getattr(obj, name, *defargs)
except Exception:
# sometimes accessing a property raises an exception (e.g.
# NotImplementedError), so let's try to read the attribute directly
if name in obj.__dict__:
return obj.__dict__[name]
# this is a catch-all for all the weird things that some modules do
# with attribute access
if defargs: