From c7ba04e2dd9000d6a1abbfe44351ed5ba0c3fa34 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sun, 24 Jul 2022 14:33:42 -0400 Subject: [PATCH] BF(DOC): workaround for #10701 of sphinx in 5.1.0 See https://github.com/sphinx-doc/sphinx/issues/10701 for more information. I have not checked if rendered docs are anyhow affected etc. I hope the issue would get fixed asap since should affect lots of sphinx users --- docs/source/conf.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 41014f4c83..08f2dc06f3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -351,3 +351,24 @@ def setup(sphinx): ), None), } + + +import sphinx +if sphinx.__version__ == '5.1.0': + # see https://github.com/sphinx-doc/sphinx/issues/10701 + # hope is it would get fixed for the next release + + # Although crash happens within NumpyDocstring, it is subclass of GoogleDocstring + # so we need to overload method there + from sphinx.ext.napoleon.docstring import GoogleDocstring + from functools import wraps + + + @wraps(GoogleDocstring._consume_inline_attribute) + def _consume_inline_attribute_safe(self): + try: + return self._consume_inline_attribute_safe() + except: + return "", [] + + GoogleDocstring._consume_inline_attribute = _consume_inline_attribute_safe \ No newline at end of file