Message305525
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. |
|
Date |
User |
Action |
Args |
2017-11-03 23:31:32 | vstinner | set | recipients:
+ vstinner, brett.cannon, ncoghlan, larry, serhiy.storchaka, yselivanov |
2017-11-03 23:31:32 | vstinner | set | messageid: <1509751892.64.0.213398074469.issue31939@psf.upfronthosting.co.za> |
2017-11-03 23:31:32 | vstinner | link | issue31939 messages |
2017-11-03 23:31:32 | vstinner | create | |
|