[Python-Dev] unicode/string asymmetries
Martin v. Loewis
martin@v.loewis.de
Wed, 9 Jan 2002 22:14:26 +0100
> So, I would like PyArg_Parse/Py_BuildValue formats that are
> symmetric to "s", "s#" and "z" but that return wchar_t strings and
> that work with both UnicodeObjects and StringObjects.
Unfortunately, that is quite difficult. Python does not guarantee that
the internal representation of Unicode strings uses wchar_t, so such a
conversion definitely requires explicit memory management. This is
unlike plain strings, which do guarantee that the internal
representation is char[].
Regards,
Martin