Slight Issues with sip_array.c format being specified
Ognyan Moore
ognyan.moore at gmail.com
Mon Jun 26 06:47:47 BST 2023
Hi Phil,
Just came across an issue in sip_array.c::sipArray_getbuffer
code to reproduce:
>>> from PyQt6 import sip, QtCore
>>> memoryview(sip.array(QtCore.QPointF, 2))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
BufferError: format has not been specified
Looks like non-scalar types don't have a format, and if the requestor
requests a buffer format to be specified and there isn't one, an exception
is raised.
A more sensible default might be to set the format to bytes in this case.
There is some precedence here as python's PyBuffer_FillInfo will populate
format as "B".
Also, it looks like a memory leak will occur when this exception is raised
as well.
Thanks again for your work on this!
Ogi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20230625/f8b747d6/attachment.htm>
More information about the PyQt
mailing list