Skip to content

Commit 49fd47d

Browse files
authored
Merge pull request #164 from jnothman/exception-info
report object name upon mangle_docstrings exception
2 parents 0ec9e22 + a29e8c3 commit 49fd47d

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sudo: false
66
matrix:
77
include:
88
- python: 3.7
9-
env: SPHINX_SPEC="==1.2.3" SPHINXOPTS=""
9+
env: SPHINX_SPEC="==1.6.5" SPHINXOPTS=""
1010
- python: 3.7
1111
- python: 2.7
1212
cache:

numpydoc/numpydoc.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131

3232
from docutils.nodes import citation, Text, section, comment, reference
3333
import sphinx
34-
from sphinx.addnodes import pending_xref, desc_content, only
34+
from sphinx.addnodes import pending_xref, desc_content
35+
from sphinx.util import logging
3536

3637
if sphinx.__version__ < '1.0.1':
3738
raise RuntimeError("Sphinx 1.0.1 or newer is required")
@@ -40,6 +41,8 @@
4041
from .xref import DEFAULT_LINKS
4142
from . import __version__
4243

44+
logger = logging.getLogger(__name__)
45+
4346
if sys.version_info[0] >= 3:
4447
sixu = lambda s: s
4548
else:
@@ -169,13 +172,17 @@ def mangle_docstrings(app, what, name, obj, options, lines):
169172
title_re = re.compile(sixu(pattern), re.I | re.S)
170173
lines[:] = title_re.sub(sixu(''), u_NL.join(lines)).split(u_NL)
171174
else:
172-
doc = get_doc_object(obj, what, u_NL.join(lines), config=cfg,
173-
builder=app.builder)
174-
if sys.version_info[0] >= 3:
175-
doc = str(doc)
176-
else:
177-
doc = unicode(doc)
178-
lines[:] = doc.split(u_NL)
175+
try:
176+
doc = get_doc_object(obj, what, u_NL.join(lines), config=cfg,
177+
builder=app.builder)
178+
if sys.version_info[0] >= 3:
179+
doc = str(doc)
180+
else:
181+
doc = unicode(doc)
182+
lines[:] = doc.split(u_NL)
183+
except:
184+
logger.error('[numpydoc] While processing docstring for %r', name)
185+
raise
179186

180187
if (app.config.numpydoc_edit_link and hasattr(obj, '__name__') and
181188
obj.__name__):

0 commit comments

Comments
 (0)