Skip to content

report object name upon mangle_docstrings exception #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
23 changes: 15 additions & 8 deletions numpydoc/numpydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@

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")
Expand All @@ -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:
Expand Down Expand Up @@ -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('[numpydoc] While processing docstring for %r', name)
raise

if (app.config.numpydoc_edit_link and hasattr(obj, '__name__') and
obj.__name__):
Expand Down