mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '4.3.x' into 9864_mathjax_loading_method
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -21,6 +21,8 @@ Bugs fixed
|
||||
|
||||
* #9838: autodoc: AttributeError is raised on building document for functions
|
||||
decorated by functools.lru_cache
|
||||
* #9879: autodoc: AttributeError is raised on building document for an object
|
||||
having invalid __doc__ atribute
|
||||
* #9864: mathjax: Failed to render equations via MathJax v2. The loading method
|
||||
of MathJax is back to "async" method again
|
||||
|
||||
|
||||
@@ -1704,7 +1704,7 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
|
||||
classdoc_from = self.options.get('class-doc-from', self.config.autoclass_content)
|
||||
|
||||
docstrings = []
|
||||
attrdocstring = self.get_attr(self.object, '__doc__', None)
|
||||
attrdocstring = getdoc(self.object, self.get_attr)
|
||||
if attrdocstring:
|
||||
docstrings.append(attrdocstring)
|
||||
|
||||
|
||||
@@ -871,6 +871,13 @@ def getdoc(obj: Any, attrgetter: Callable = safe_getattr,
|
||||
* inherited docstring
|
||||
* inherited decorated methods
|
||||
"""
|
||||
def getdoc_internal(obj: Any, attrgetter: Callable = safe_getattr) -> Optional[str]:
|
||||
doc = attrgetter(obj, '__doc__', None)
|
||||
if isinstance(doc, str):
|
||||
return doc
|
||||
else:
|
||||
return None
|
||||
|
||||
if cls and name and isclassmethod(obj, cls, name):
|
||||
for basecls in getmro(cls):
|
||||
meth = basecls.__dict__.get(name)
|
||||
@@ -879,7 +886,7 @@ def getdoc(obj: Any, attrgetter: Callable = safe_getattr,
|
||||
if doc is not None or not allow_inherited:
|
||||
return doc
|
||||
|
||||
doc = attrgetter(obj, '__doc__', None)
|
||||
doc = getdoc_internal(obj)
|
||||
if ispartial(obj) and doc == obj.__class__.__doc__:
|
||||
return getdoc(obj.func)
|
||||
elif doc is None and allow_inherited:
|
||||
@@ -888,7 +895,7 @@ def getdoc(obj: Any, attrgetter: Callable = safe_getattr,
|
||||
for basecls in getmro(cls):
|
||||
meth = safe_getattr(basecls, name, None)
|
||||
if meth is not None:
|
||||
doc = attrgetter(meth, '__doc__', None)
|
||||
doc = getdoc_internal(meth)
|
||||
if doc is not None:
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user