This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Argument Clinic: functions with valid sig but no docstring have no __text_signature__
Type: behavior Stage: resolved
Components: Argument Clinic, Demos and Tools Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zach.ware Nosy List: larry, python-dev, zach.ware
Priority: normal Keywords: patch

Created on 2014-02-10 20:28 by zach.ware, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue20586.diff zach.ware, 2014-07-28 19:10 Rietveld-friendly patch. review
issue20586.v2.diff zach.ware, 2014-08-05 20:16 review
issue20586.v3.diff zach.ware, 2015-04-13 22:18 review
Messages (8)
msg210864 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-02-10 20:28
Builtins with a valid signature embedded in the docstring, but with no other docstring content are not picked up by the __text_signature__ getter because the docstring ends with ")\n--" rather than ")\n--\n\n".  The attached patch adjusts clinic.CLanguage.docstring_for_c_string to make sure that the rendered docstring ends in "--\n\n" rather than "--".

The result is a correct __text_signature__ and a __doc__ of ''.
msg210869 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-02-10 21:22
Forgot to mention, there are no current examples of this checked in.  winreg.HKEYType has a couple of methods with no docstring (__enter__ and __exit__), and _winapi has several docstring-less functions, though.
msg224777 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-08-04 21:23
This looks reasonable to me.  However I'd also change _PyType_GetDocFromInternalDoc() so that it also returns None if the first byte of the doc is \0.
msg224881 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-08-05 20:16
Something about like this?  Note that this does change the behavior in the case where the whole docstring is empty but provided (such as when WITH_DOC_STRINGS == 0; see the changed line in test_capi).
msg240784 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2015-04-13 22:18
Here's an updated patch for clean application.  Larry, could you give this a look?
msg240802 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2015-04-13 23:08
LGTM
msg240805 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-13 23:22
New changeset e75fd221a53e by Zachary Ware in branch 'default':
Issue #20586: Argument Clinic now ensures signatures on functions without docstrings.
https://hg.python.org/cpython/rev/e75fd221a53e
msg240806 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2015-04-13 23:24
Thanks Larry
History
Date User Action Args
2022-04-11 14:57:58adminsetgithub: 64785
2015-04-13 23:24:09zach.waresetstatus: open -> closed
versions: - Python 3.4
messages: + msg240806

resolution: fixed
stage: patch review -> resolved
2015-04-13 23:22:45python-devsetnosy: + python-dev
messages: + msg240805
2015-04-13 23:08:33larrysetassignee: zach.ware
messages: + msg240802
2015-04-13 22:18:47zach.waresetfiles: + issue20586.v3.diff

messages: + msg240784
2015-02-25 15:28:43serhiy.storchakasetcomponents: + Argument Clinic
2014-08-05 20:16:22zach.waresetfiles: + issue20586.v2.diff

messages: + msg224881
2014-08-04 21:23:36larrysetmessages: + msg224777
2014-07-28 19:11:25zach.warelinkissue20172 dependencies
2014-07-28 19:10:19zach.waresetfiles: - clinic_sig_no_docstring.diff
2014-07-28 19:10:11zach.waresetfiles: + issue20586.diff
versions: + Python 3.5
2014-02-10 21:22:09zach.waresetmessages: + msg210869
2014-02-10 20:28:26zach.warecreate