Bug description:
curses.complexstr is new in 3.16 and its signature cannot be introspected:
import curses, inspect
print(inspect.signature(curses.complexchar)) # the sibling type
print(curses.complexstr.__text_signature__)
inspect.signature(curses.complexstr)
(text, /, attr=0, pair=0)
(cells, /, attr=<unrepresentable>, pair=<unrepresentable>)
ValueError: <class 'curses.complexstr'> builtin has invalid signature
help(curses.complexstr) still works, but shows the placeholder to the reader:
| complexstr(cells, /, attr=<unrepresentable>, pair=<unrepresentable>)
Both optional parameters are declared object = NULL
(Modules/_cursesmodule.c:1415 and :1417), and NULL has no Python repr, so Argument
Clinic writes <unrepresentable> into the text signature at
Modules/clinic/_cursesmodule.c.h:105. It is the only one in that file.
curses.complexchar, whose attr and pair have real defaults, introspects fine.
A representable default fixes it without changing behaviour, for example
object(c_default="NULL") = None, which 37 other stdlib parameters already use. _md5.md5
shows the effect: its signature reads string=None while the C default stays NULL, so
"omitted" and "given" remain distinguishable.
The same clinic pattern leaves an <unrepresentable> in 24 other generated files, so this
is not a new kind of problem. complexstr is worth fixing now because it has not shipped
yet.
GH-152262 (gh-152233) added the type. It is the origin of this, not a report of it.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug description:
curses.complexstris new in 3.16 and its signature cannot be introspected:help(curses.complexstr)still works, but shows the placeholder to the reader:Both optional parameters are declared
object = NULL(
Modules/_cursesmodule.c:1415and:1417), andNULLhas no Python repr, so ArgumentClinic writes
<unrepresentable>into the text signature atModules/clinic/_cursesmodule.c.h:105. It is the only one in that file.curses.complexchar, whose attr and pair have real defaults, introspects fine.A representable default fixes it without changing behaviour, for example
object(c_default="NULL") = None, which 37 other stdlib parameters already use._md5.md5shows the effect: its signature reads
string=Nonewhile the C default staysNULL, so"omitted" and "given" remain distinguishable.
The same clinic pattern leaves an
<unrepresentable>in 24 other generated files, so thisis not a new kind of problem.
complexstris worth fixing now because it has not shippedyet.
GH-152262(gh-152233) added the type. It is the origin of this, not a report of it.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs