mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 15:12:01 +00:00
ee9296395d
Some versions of Python 2.7 reportedly (#713) have issues with PyUnicode_Decode being passed the encoding string, so just skip it entirely by calling the PyUnicode_DecodeUTF* function directly. This will also be slightly more efficient by avoiding having to check the encoding string, and (for python 2) going through the unicode class's decode (python 3 fast-tracks this for all utf-{8,16,32} encodings; python 2 only fast-tracked for the exact string "utf-8", which we weren't passing anyway (we had "utf8")). This doesn't work for PyPy, however: its `PyUnicode_DecodeUTF{8,16,32}` appear rather broken: the UTF8 one segfaults, while the 16/32 require recasting into a non-const `char *` (and might segfault; I didn't get far enough to find out). Just avoid the whole thing by keeping the encoding-passed-as-string version for PyPy, which seems to work reliably. |
||
---|---|---|
.. | ||
pybind11 |