Closed
Description
Bug report
Bug description:
Calling PyObject_GetBuffer()
with the PyBUF_FORMAT
flag on a memoryview object that wraps a bytes object fails with the exception:
BufferError: memoryview: cannot cast to unsigned bytes if the format flag is present
Calling it directly on the same bytes object does not fail.
The test is in memory_getbuf()
in memoryobject.c. The test is failing because format
is not NULL
. format
is actually "B"
which is the equivalent of NULL
. I think the test should be changed to allow a format
value of "B"
.
An alternative might be to change PyBuffer_FillInfo()
to always set format
to NULL
.
CPython versions tested on:
3.12, 3.13
Operating systems tested on:
Linux, macOS