
On 01/02/2021 17.39, M.-A. Lemburg wrote:
Can you explain where wchar_t* type is appropriate and how two conversions is a performance bottleneck?
If an extension has a wchar_t* string, it should be easy to convert this in to a Python bytes object for use in Python.
How much software actually uses wchar_t these days and interfaces with Python? Do you have examples for software that uses wchar_t and would benefit from wchar_t support in Python? I did a quick search for wcslen in all shared libraries and binaries on my system. It's a good indicator how many programs actually use wchar_t. 126 out of more than 9,000 shared libraries and binaries contain the string "wcslen". The only hit for PyUnicode_AsWideCharString was libpypy3-c.so... (Fedora has unified /usr and /lib64, e.g. /bin -> /usr/bin) $ ls /usr/bin/ /usr/sbin/ | grep -v python | wc -l 4264 $ grep -R wcslen /usr/bin/ /usr/sbin/ | grep -v python | wc -l 92 $ find /usr/lib64/ -name '*.so' -not -name '*python*' | wc -l 5478 $ find /usr/lib64/ -name '*.so' -not -name '*python*' | xargs grep wcslen | wc -l 34 Christian