mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #9644 from xmo-odoo/fix-sourcename-broken-getattr
Protect `sphinx.ext.autodoc.get_sourcename` against misbehaving `__getattr__`
This commit is contained in:
commit
62fd91b8d1
@ -585,8 +585,8 @@ class Documenter:
|
||||
yield from docstringlines
|
||||
|
||||
def get_sourcename(self) -> str:
|
||||
if (getattr(self.object, '__module__', None) and
|
||||
getattr(self.object, '__qualname__', None)):
|
||||
if (inspect.safe_getattr(self.object, '__module__', None) and
|
||||
inspect.safe_getattr(self.object, '__qualname__', None)):
|
||||
# Get the correct location of docstring from self.object
|
||||
# to support inherited methods
|
||||
fullname = '%s.%s' % (self.object.__module__, self.object.__qualname__)
|
||||
|
Loading…
Reference in New Issue
Block a user