Description
mangle_docstrings at numpydoc.py:191 calls cfg.update(options or {}) where options is a _AutoDocumenterOptions instance passed by Sphinx's autodoc-process-docstring event.
Since Sphinx 10, _AutoDocumenterOptions emits RemovedInSphinx11Warning when its mapping interface (__iter__, __getitem__, etc.) is used. dict.update() triggers __iter__ on the options object, producing:
The mapping interface for autodoc options objects is deprecated,
and will be removed in Sphinx 11. Use attribute access instead.
Suggested fix
Replace the try/except block:
# current
try:
cfg.update(options or {})
except TypeError:
cfg.update(options.__dict__ or {})
with:
if options is not None:
cfg.update(vars(options))
vars(options) returns the instance __dict__ directly, avoiding the deprecated mapping interface entirely. This works because _AutoDocumenterOptions.__init__ stores all attributes via vars(self).update(kwargs).
Related
Description
mangle_docstringsat numpydoc.py:191 callscfg.update(options or {})whereoptionsis a_AutoDocumenterOptionsinstance passed by Sphinx'sautodoc-process-docstringevent.Since Sphinx 10,
_AutoDocumenterOptionsemitsRemovedInSphinx11Warningwhen its mapping interface (__iter__,__getitem__, etc.) is used.dict.update()triggers__iter__on the options object, producing:Suggested fix
Replace the try/except block:
with:
vars(options)returns the instance__dict__directly, avoiding the deprecated mapping interface entirely. This works because_AutoDocumenterOptions.__init__stores all attributes viavars(self).update(kwargs).Related