From 090a5f956c391ecd1716016d4fa0087d27bbc060 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Mon, 25 Jul 2022 12:34:47 +0200 Subject: [PATCH] docs: workaround for sphinx-doc/sphinx#10701 add workaround of @yarikoptic to conf.py for Sphinx 5.1.0 --- CHANGELOG.md | 1 + docs/conf.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 347d379cb..7be039fcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,7 @@ CHANGELOG ### Documentation - Feeds: Add documentation for newly supported dataplane feeds, see above (PR#2102 by Mikk Margus Möll). - Installation: Restructured the whole document to make it clearer and straight-forward (PR#2113 by Sebastian Wagner). +- Add workaround for https://github.com/sphinx-doc/sphinx/issues/10701 (PR#2225 by Sebastian Wagner, kudos @yarikoptic, fixes #2224). ### Packaging diff --git a/docs/conf.py b/docs/conf.py index b79ed45c5..7c9cae8c4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -116,3 +116,25 @@ def run_autogen(_): def setup(app): app.connect("builder-inited", run_apidoc) app.connect("builder-inited", run_autogen) + + + +import sphinx +if sphinx.__version__ == '5.1.0': + # see https://github.com/sphinx-doc/sphinx/issues/10701 + # workaround copied from https://github.com/datalad/datalad/pull/6883 + + # 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