Skip to content

Commit 7280356

Browse files
committed
ENH: use __text_signature__ if pydoc.doc does not reveal a signature.
This allows to support the __text_signature__ property on Python 3.4+ to document C functions.
1 parent 5084f79 commit 7280356

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

numpydoc/numpydoc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ def mangle_signature(app, what, name, obj, options, sig, retann):
114114
return
115115

116116
doc = SphinxDocString(pydoc.getdoc(obj))
117-
if doc['Signature']:
118-
sig = re.sub(sixu("^[^(]*"), sixu(""), doc['Signature'])
117+
sig = doc['Signature'] or getattr(obj, '__text_signature__', None)
118+
if sig:
119+
sig = re.sub(sixu("^[^(]*"), sixu(""), sig)
119120
return sig, sixu('')
120121

121122

0 commit comments

Comments
 (0)