@@ -180,7 +180,9 @@ def __init__(self) -> None:
180180 super ().__init__ (env , None , Options (), 0 , state )
181181
182182
183- def get_documenter (app : Sphinx , obj : Any , parent : Any ) -> type [Documenter ]:
183+ def _get_documenter (
184+ obj : Any , parent : Any , * , registry : SphinxComponentRegistry
185+ ) -> type [Documenter ]:
184186 """Get an autodoc.Documenter class suitable for documenting the given
185187 object.
186188
@@ -196,7 +198,7 @@ def get_documenter(app: Sphinx, obj: Any, parent: Any) -> type[Documenter]:
196198
197199 # Construct a fake documenter for *parent*
198200 if parent is not None :
199- parent_doc_cls = get_documenter ( app , parent , None )
201+ parent_doc_cls = _get_documenter ( parent , None , registry = registry )
200202 else :
201203 parent_doc_cls = ModuleDocumenter
202204
@@ -208,7 +210,7 @@ def get_documenter(app: Sphinx, obj: Any, parent: Any) -> type[Documenter]:
208210 # Get the correct documenter class for *obj*
209211 classes = [
210212 cls
211- for cls in app . registry .documenters .values ()
213+ for cls in registry .documenters .values ()
212214 if cls .can_document_member (obj , '' , False , parent_doc )
213215 ]
214216 if classes :
@@ -318,14 +320,19 @@ def import_by_name(
318320 raise ImportExceptionGroup (exc .args [0 ], errors ) from None
319321
320322 def create_documenter (
321- self , app : Sphinx , obj : Any , parent : Any , full_name : str
323+ self ,
324+ obj : Any ,
325+ parent : Any ,
326+ full_name : str ,
327+ * ,
328+ registry : SphinxComponentRegistry ,
322329 ) -> Documenter :
323330 """Get an autodoc.Documenter class suitable for documenting the given
324331 object.
325332
326- Wraps get_documenter and is meant as a hook for extensions.
333+ Wraps _get_documenter and is meant as a hook for extensions.
327334 """
328- doccls = get_documenter ( app , obj , parent )
335+ doccls = _get_documenter ( obj , parent , registry = registry )
329336 return doccls (self .bridge , full_name )
330337
331338 def get_items (self , names : list [str ]) -> list [tuple [str , str | None , str , str ]]:
@@ -378,7 +385,9 @@ def get_items(self, names: list[str]) -> list[tuple[str, str | None, str, str]]:
378385 full_name = modname + '::' + full_name [len (modname ) + 1 :]
379386 # NB. using full_name here is important, since Documenters
380387 # handle module prefixes slightly differently
381- documenter = self .create_documenter (self .env .app , obj , parent , full_name )
388+ documenter = self .create_documenter (
389+ obj , parent , full_name , registry = self .env ._registry
390+ )
382391 if not documenter .parse_name ():
383392 logger .warning (
384393 __ ('failed to parse name %s' ),
0 commit comments