New submission from STINNER Victor <victor.stin...@gmail.com>: 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. ---------- messages: 305525 nosy: brett.cannon, haypo, larry, ncoghlan, serhiy.storchaka, yselivanov priority: normal severity: normal status: open title: Support return annotation in signature for Argument Clinic type: enhancement versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31939> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com