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.

Author vstinner
Recipients brett.cannon, larry, ncoghlan, serhiy.storchaka, vstinner, yselivanov
Date 2017-11-03.23:31:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509751892.64.0.213398074469.issue31939@psf.upfronthosting.co.za>
In-reply-to
Content
Argument Clinic supports a few return types like NoneType, int, bool, etc. But the return type is omitted in the private docstring used to build the __text_signature__, finally used to build a Signature object in inspect.signature().


For example, os.dup() is declared in Modules/posixmodule.c with:

/*[clinic input]
os.dup -> int

    fd: int
    /

Return a duplicate of a file descriptor.
[clinic start generated code]*/


Currently, Argument Clinic generates:

PyDoc_STRVAR(os_dup__doc__,
"dup($module, fd, /)\n"
"--\n"
"\n"
"Return a duplicate of a file descriptor.");

The return type is omitted in the first line.


Finally, the return type is not documented in the signature:

haypo@selma$ ./python -c "import os,inspect; print(inspect.signature(os.dup))"
(fd, /)


I noticed this limitation while reviewing the PR 4265 which converts the select module to Argument Clinic. Previously, the return type like "-> None" or "-> int" was documented. With Argument Clinic, it's not documented nor generated in the signature, the information is lost.
History
Date User Action Args
2017-11-03 23:31:32vstinnersetrecipients: + vstinner, brett.cannon, ncoghlan, larry, serhiy.storchaka, yselivanov
2017-11-03 23:31:32vstinnersetmessageid: <1509751892.64.0.213398074469.issue31939@psf.upfronthosting.co.za>
2017-11-03 23:31:32vstinnerlinkissue31939 messages
2017-11-03 23:31:32vstinnercreate