[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Slight Issues with sip_array.c format being specified
From:       Ognyan Moore <ognyan.moore () gmail ! com>
Date:       2023-06-26 5:47:47
Message-ID: CA+nduTGnA=yCCBFXyhkjHrgGxvqd9YFBcjvPdZb1ECzDpbhm7w () mail ! gmail ! com
[Download RAW message or body]

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

[Attachment #3 (text/html)]

<div dir="ltr">Hi Phil,<br><div><br></div><div>Just came across an issue in \
sip_array.c::sipArray_getbuffer</div><div><br></div><div>code to \
reproduce:</div><div><br></div><div>&gt;&gt;&gt; from PyQt6 import sip, \
QtCore</div><div>&gt;&gt;&gt; memoryview(sip.array(QtCore.QPointF, 2))<br>Traceback \
(most recent call last):<br>   File &quot;&lt;stdin&gt;&quot;, line 1, in \
&lt;module&gt;<br>BufferError: format has not been \
specified<br></div><div><br></div><div>Looks like non-scalar types don&#39;t have a \
format, and if the requestor requests a buffer format to be specified and there \
isn&#39;t one, an exception is raised.</div><div><br></div><div>A more sensible \
default  might be to set the format to bytes in this case.   There is some precedence \
here as python&#39;s PyBuffer_FillInfo will populate format as \
&quot;B&quot;.</div><div><br></div><div>Also, it looks like a memory leak will occur \
when this exception is raised as well.</div><div><br></div><div>Thanks again for your \
work on this!</div><div>Ogi</div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic