From 5903931c6bad452d86e1909f31c9b8c95c2830b7 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 9 Oct 2025 22:44:07 -0400 Subject: [PATCH 1/3] FIX: account for unreleased changes to sphinx Reported upstream at: https://github.com/sphinx-doc/sphinx/issues/13942 The type of `options` has changed to a custom type so the merging logic no longer works as expected. This is probably the wrong long term fix, but gets Matplotlib's docs building again. --- numpydoc/numpydoc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/numpydoc/numpydoc.py b/numpydoc/numpydoc.py index b1431519..7fd39e78 100644 --- a/numpydoc/numpydoc.py +++ b/numpydoc/numpydoc.py @@ -185,8 +185,10 @@ def mangle_docstrings(app: SphinxApp, what, name, obj, options, lines): "xref_aliases": app.config.numpydoc_xref_aliases_complete, "xref_ignore": app.config.numpydoc_xref_ignore, } - - cfg.update(options or {}) + if isinstance(options, dict): + cfg.update(options or {}) + else: + cfg.update(options.__dict__ or {}) u_NL = "\n" if what == "module": # Strip top title From 9d41917d0404cb7b3f424d66edd3c4e23f5b9174 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 9 Oct 2025 22:51:07 -0400 Subject: [PATCH 2/3] FIX: try duck-typing error handling --- numpydoc/numpydoc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/numpydoc/numpydoc.py b/numpydoc/numpydoc.py index 7fd39e78..1ab2a77d 100644 --- a/numpydoc/numpydoc.py +++ b/numpydoc/numpydoc.py @@ -185,9 +185,9 @@ def mangle_docstrings(app: SphinxApp, what, name, obj, options, lines): "xref_aliases": app.config.numpydoc_xref_aliases_complete, "xref_ignore": app.config.numpydoc_xref_ignore, } - if isinstance(options, dict): + try: cfg.update(options or {}) - else: + except TypeError: cfg.update(options.__dict__ or {}) u_NL = "\n" if what == "module": From 8453733185adee4c99754bf8fe829151bd315985 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 10 Oct 2025 09:38:31 -0400 Subject: [PATCH 3/3] Apply suggestion from @larsoner --- numpydoc/numpydoc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/numpydoc/numpydoc.py b/numpydoc/numpydoc.py index 1ab2a77d..2b9757d7 100644 --- a/numpydoc/numpydoc.py +++ b/numpydoc/numpydoc.py @@ -185,6 +185,8 @@ def mangle_docstrings(app: SphinxApp, what, name, obj, options, lines): "xref_aliases": app.config.numpydoc_xref_aliases_complete, "xref_ignore": app.config.numpydoc_xref_ignore, } + # TODO: Find a cleaner way to take care of this change away from dict + # https://github.com/sphinx-doc/sphinx/issues/13942 try: cfg.update(options or {}) except TypeError: