mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #2731 from seanfarley/fix-abstractproperty
inspect: return obj.__dict__[name] if there is an exception
This commit is contained in:
commit
6227a7f98c
@ -108,6 +108,10 @@ def safe_getattr(obj, name, *defargs):
|
|||||||
try:
|
try:
|
||||||
return getattr(obj, name, *defargs)
|
return getattr(obj, name, *defargs)
|
||||||
except Exception:
|
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
|
# this is a catch-all for all the weird things that some modules do
|
||||||
# with attribute access
|
# with attribute access
|
||||||
if defargs:
|
if defargs:
|
||||||
|
Loading…
Reference in New Issue
Block a user