From 8d4da3b0191f9ca35e2fed872c54045de233c83b Mon Sep 17 00:00:00 2001 From: Joel Nothman Date: Tue, 10 Apr 2018 09:26:52 +1000 Subject: [PATCH 1/3] report object name upon mangle_docstrings exception --- numpydoc/numpydoc.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/numpydoc/numpydoc.py b/numpydoc/numpydoc.py index e1b8f263..0169dc2d 100644 --- a/numpydoc/numpydoc.py +++ b/numpydoc/numpydoc.py @@ -28,6 +28,7 @@ from collections import Callable import hashlib import itertools +import logging from docutils.nodes import citation, Text, section, comment, reference import sphinx @@ -40,6 +41,8 @@ from .xref import DEFAULT_LINKS from . import __version__ +logger = logging.getLogger(__name__) + if sys.version_info[0] >= 3: sixu = lambda s: s else: @@ -169,13 +172,17 @@ def mangle_docstrings(app, what, name, obj, options, lines): title_re = re.compile(sixu(pattern), re.I | re.S) lines[:] = title_re.sub(sixu(''), u_NL.join(lines)).split(u_NL) else: - doc = get_doc_object(obj, what, u_NL.join(lines), config=cfg, - builder=app.builder) - if sys.version_info[0] >= 3: - doc = str(doc) - else: - doc = unicode(doc) - lines[:] = doc.split(u_NL) + try: + doc = get_doc_object(obj, what, u_NL.join(lines), config=cfg, + builder=app.builder) + if sys.version_info[0] >= 3: + doc = str(doc) + else: + doc = unicode(doc) + lines[:] = doc.split(u_NL) + except: + logger.error('While processing numpydoc for %r', name) + raise if (app.config.numpydoc_edit_link and hasattr(obj, '__name__') and obj.__name__): From ebb6c9b80c3088f6db8732d45c578b0a9ea2c947 Mon Sep 17 00:00:00 2001 From: Joel Nothman Date: Thu, 12 Apr 2018 21:37:51 +1000 Subject: [PATCH 2/3] Fixes for Joris --- numpydoc/numpydoc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/numpydoc/numpydoc.py b/numpydoc/numpydoc.py index 0169dc2d..0e96fadf 100644 --- a/numpydoc/numpydoc.py +++ b/numpydoc/numpydoc.py @@ -28,11 +28,11 @@ from collections import Callable import hashlib import itertools -import logging from docutils.nodes import citation, Text, section, comment, reference import sphinx -from sphinx.addnodes import pending_xref, desc_content, only +from sphinx.addnodes import pending_xref, desc_content +from sphinx.util import logging if sphinx.__version__ < '1.0.1': raise RuntimeError("Sphinx 1.0.1 or newer is required") @@ -181,7 +181,7 @@ def mangle_docstrings(app, what, name, obj, options, lines): doc = unicode(doc) lines[:] = doc.split(u_NL) except: - logger.error('While processing numpydoc for %r', name) + logger.error('[numpydoc] While processing docstring for %r', name) raise if (app.config.numpydoc_edit_link and hasattr(obj, '__name__') and From a29e8c3c86f96aa8ddcfc80c12f2063e08c7fb0c Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Sun, 21 Apr 2019 17:29:48 +0200 Subject: [PATCH 3/3] CI: bump minimum Sphinx version tested from 1.2.3 to 1.6.5 1.6.5 is now 1.5 years old, should be enough. sphinx.util.logging is not present in 1.2.3, was introduced in 1.6.0; --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8ffb2bbc..7db72a65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ sudo: false matrix: include: - python: 3.7 - env: SPHINX_SPEC="==1.2.3" SPHINXOPTS="" + env: SPHINX_SPEC="==1.6.5" SPHINXOPTS="" - python: 3.7 - python: 2.7 cache: