Skip to content

Commit

Permalink
fixup! Add autodoc:{class,module}
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Nov 22, 2024
1 parent e72a3d7 commit 58c16d1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions sphinx/ext/autodoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,14 +1184,13 @@ def resolve_name(self, modname: str | None, parents: Any, path: str, base: str,
# if documenting a class-level object without path,
# there must be a current class, either from a parent
# auto directive ...
mod_cls_ = self.env.current_document.autodoc_class
mod_cls = self.env.current_document.autodoc_class
# ... or from a class directive
if not mod_cls_:
mod_cls_ = self.env.ref_context.get('py:class')
# ... if still None, there's no way to know
if mod_cls_ is None:
if not mod_cls:
mod_cls = self.env.ref_context.get('py:class', '')
# ... if still falsy, there's no way to know
if not mod_cls:
return None, []
mod_cls = mod_cls_
modname, sep, cls = mod_cls.rpartition('.')
parents = [cls]
# if the module name is still missing, get it like above
Expand Down

0 comments on commit 58c16d1

Please sign in to comment.