|
31 | 31 |
|
32 | 32 | from docutils.nodes import citation, Text, section, comment, reference
|
33 | 33 | 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 |
35 | 36 |
|
36 | 37 | if sphinx.__version__ < '1.0.1':
|
37 | 38 | raise RuntimeError("Sphinx 1.0.1 or newer is required")
|
|
40 | 41 | from .xref import DEFAULT_LINKS
|
41 | 42 | from . import __version__
|
42 | 43 |
|
| 44 | +logger = logging.getLogger(__name__) |
| 45 | + |
43 | 46 | if sys.version_info[0] >= 3:
|
44 | 47 | sixu = lambda s: s
|
45 | 48 | else:
|
@@ -169,13 +172,17 @@ def mangle_docstrings(app, what, name, obj, options, lines):
|
169 | 172 | title_re = re.compile(sixu(pattern), re.I | re.S)
|
170 | 173 | lines[:] = title_re.sub(sixu(''), u_NL.join(lines)).split(u_NL)
|
171 | 174 | 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 |
179 | 186 |
|
180 | 187 | if (app.config.numpydoc_edit_link and hasattr(obj, '__name__') and
|
181 | 188 | obj.__name__):
|
|
0 commit comments