Skip to content

Commit 5b03f4e

Browse files
committed
add context to signature mangling errors
1 parent 6df5c12 commit 5b03f4e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

numpydoc/numpydoc.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ def mangle_signature(app, what, name, obj, options, sig, retann):
113113

114114
if not hasattr(obj, '__doc__'):
115115
return
116-
117-
doc = SphinxDocString(pydoc.getdoc(obj))
116+
try:
117+
doc = SphinxDocString(pydoc.getdoc(obj))
118+
except ValueError as e:
119+
filename = obj.__code__.co_filename
120+
raise ValueError(str(e) + " in {}:{}".format(filename, name))
118121
sig = doc['Signature'] or getattr(obj, '__text_signature__', None)
119122
if sig:
120123
sig = re.sub(sixu("^[^(]*"), sixu(""), sig)

0 commit comments

Comments
 (0)