[PyQt] [PyQT] Segfault when pickling a QByteArray

cantabile cantabile.desu at gmail.com
Tue Dec 20 13:30:48 GMT 2011


On 12/19/2011 05:53 PM, Phil Thompson wrote:
> On Mon, 19 Dec 2011 14:49:18 +0200, cantabile<cantabile.desu at gmail.com>
> wrote:
>> Hello,
>>
>> The sample code is attached. It segfaults at pickle.dump().
>> However, pickling something like QByteArray("asdf") works fine.
>> This is with python 3. The exact same code works with python 2
>> (same pyqt, sip and qt versions).
>>
>> A backtrace is also attached. I see a lot of "<optimized out>" in the
>> backtrace - should I recompile python and/or sip with -O0 or something
>> like that?
>>
>> Python 3 version: 3.2.2
>> Python 2 version: 2.7.2
>> Pyqt     version: 4.8.6
>> Sip      version: 4.13
>> Qt       version: 4.7.4
>>
>> Operating system: 64 bit arch linux.
>
> Hmm, one SIP bug, one PyQt bug. Fixed in tonight's snapshots.
>
> Thanks,
> Phil
That was fast. Thank you. :)

The segfault is gone. However, the sample I attached still doesn't work
as is with python 3. I get this error:
~~~~~~~~~~~~~~~~~~~~
     pickle.dump(tmp_bytearray, f)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: 
invalid start byte
~~~~~~~~~~~~~~~~~~~~
Changing that line to:
pickle.dump(bytes(tmp_bytearray), f)
makes it all work.

I should mention that I did not use the snapshots, but instead I patched
sip 4.13 with changeset 29ec1c523114 and pyqt 4.8.6 with the attached
diff. I hope this error is not due to cherrypicking those changes.
-- 
cantabile

"Jayne is a girl's name." -- River
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-qbytearray-pickle.diff
Type: text/x-patch
Size: 1011 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20111220/af05db5c/attachment.bin>


More information about the PyQt mailing list