Skip to content

Argument Clinic: the Py_buffer converter only accepts None as the default value #144545

@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

The Py_buffer converter only accepts None as the default value, even if None is not valid value for Py_buffer. As result, you need to use tricks for optional Py_buffer parameters:

Py_buffer(py_default="b''") = None

or

Py_buffer(py_default="<unrepresentable>") = None

and then check if arg->buf is NULL.

It should support NULL (for "unrepresentable") and arbitrary bytes literals (or at least b'') as default values.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions