@@ -180,7 +180,9 @@ def __init__(self) -> None:
180
180
super ().__init__ (env , None , Options (), 0 , state )
181
181
182
182
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 ]:
184
186
"""Get an autodoc.Documenter class suitable for documenting the given
185
187
object.
186
188
@@ -196,7 +198,7 @@ def get_documenter(app: Sphinx, obj: Any, parent: Any) -> type[Documenter]:
196
198
197
199
# Construct a fake documenter for *parent*
198
200
if parent is not None :
199
- parent_doc_cls = get_documenter ( app , parent , None )
201
+ parent_doc_cls = _get_documenter ( parent , None , registry = registry )
200
202
else :
201
203
parent_doc_cls = ModuleDocumenter
202
204
@@ -208,7 +210,7 @@ def get_documenter(app: Sphinx, obj: Any, parent: Any) -> type[Documenter]:
208
210
# Get the correct documenter class for *obj*
209
211
classes = [
210
212
cls
211
- for cls in app . registry .documenters .values ()
213
+ for cls in registry .documenters .values ()
212
214
if cls .can_document_member (obj , '' , False , parent_doc )
213
215
]
214
216
if classes :
@@ -318,14 +320,19 @@ def import_by_name(
318
320
raise ImportExceptionGroup (exc .args [0 ], errors ) from None
319
321
320
322
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 ,
322
329
) -> Documenter :
323
330
"""Get an autodoc.Documenter class suitable for documenting the given
324
331
object.
325
332
326
- Wraps get_documenter and is meant as a hook for extensions.
333
+ Wraps _get_documenter and is meant as a hook for extensions.
327
334
"""
328
- doccls = get_documenter ( app , obj , parent )
335
+ doccls = _get_documenter ( obj , parent , registry = registry )
329
336
return doccls (self .bridge , full_name )
330
337
331
338
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]]:
378
385
full_name = modname + '::' + full_name [len (modname ) + 1 :]
379
386
# NB. using full_name here is important, since Documenters
380
387
# 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
+ )
382
391
if not documenter .parse_name ():
383
392
logger .warning (
384
393
__ ('failed to parse name %s' ),
0 commit comments