[issue42976] __text_signature__ parser silently drops arguments with certain unsupported default forms

Antony Lee report at bugs.python.org
Wed Jan 20 06:21:25 EST 2021


New submission from Antony Lee <anntzer.lee at gmail.com>:

Starting from the keyword-arguments example at https://docs.python.org/3/extending/extending.html#keyword-parameters-for-extension-functions, change the docstring of `parrot` to "parrot(voltage, state, action, type=1<<5)\n--\n\n" (yes, the documented default value for type does not correspond to the actual implementation, but that's irrelevant here).  Compiling the extension module and running pydoc on it yields the following parsed signature for `parrot`: `parrot(voltage, state, action)` i.e. the `type` parameter got silently dropped.  (Note that `1<<5` can legitimately occur, e.g. as a bitmask flag, especially given that one currently cannot refer to globals in __text_signature__ (https://bugs.python.org/issue37881).)

----------
components: Extension Modules
messages: 385335
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: __text_signature__ parser silently drops arguments with certain unsupported default forms

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42976>
_______________________________________


More information about the Python-bugs-list mailing list