sip 6: handling of UTF-8 in Docstrings

Scott Talbert swt at techie.net
Thu Aug 5 01:20:46 BST 2021


On Wed, 4 Aug 2021, Phil Thompson wrote:

>> I encountered a strange problem after building wxPython with sip 6.
>> When importing wxPython, I got this UnicodeDecodeError:
>> 
>> rawhide$ python -c "import wx;print(wx.version())"
>> Traceback (most recent call last):
>>   File "<string>", line 1, in <module>
>>   File "/usr/lib64/python3.10/site-packages/wx/__init__.py", line 17,
>> in <module>
>>     from wx.core import *
>>   File "/usr/lib64/python3.10/site-packages/wx/core.py", line 12, in 
>> <module>
>>     from ._core import *
>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position
>> 261: invalid continuation byte
>> free(): invalid size
>> Aborted (core dumped)
>> 
>> Upon investigating further, it seems that the root cause is that there
>> is a UTF-8 character in one of wxPython's docstrings and sip 6.1.1
>> doesn't seem to handle this correctly, whereas sip 5.5.0 does.
>> Attached is the .sip file as well as the .cpp files generated by both
>> sip 5 and sip 6 so you can see the difference:
>> 
>> 3398c3183
>> < "the wxListCtrl  it can be thought of as a façade for that complicated\n"
>> ---
>>> "the wxListCtrl  it can be thought of as a fa\xffffffc3\xffffffa7ade for
>> that complicated\n"
>
> Should be fixed in the next snapshot. Patch attached.

Thanks for the quick fix!

Scott


More information about the PyQt mailing list