Message305525
| 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. |
|