Skip to content

Commit 8d4da3b

Browse files
jnothmanrgommers
authored andcommitted
report object name upon mangle_docstrings exception
1 parent 0ec9e22 commit 8d4da3b

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

numpydoc/numpydoc.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from collections import Callable
2929
import hashlib
3030
import itertools
31+
import logging
3132

3233
from docutils.nodes import citation, Text, section, comment, reference
3334
import sphinx
@@ -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('While processing numpydoc 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)