Lack a API WCHAR* PyUnicode_WCHAR_DATA(PyObject *o), This is important for OS dependent feature port.

Py_UCS1 <http://docs.python.org/dev/c-api/unicode.html#Py_UCS1>* PyUnicode_1BYTE_DATA(PyObject<http://docs.python.org/dev/c-api/structures.html#PyObject> * *o*) Py_UCS2 <http://docs.python.org/dev/c-api/unicode.html#Py_UCS2>* PyUnicode_2BYTE_DATA(PyObject<http://docs.python.org/dev/c-api/structures.html#PyObject> * *o*) <http://docs.python.org/dev/c-api/unicode.html#PyUnicode_1BYTE_DATA> <http://docs.python.org/dev/c-api/unicode.html#PyUnicode_2BYTE_DATA> Py_UCS4<http://docs.python.org/dev/c-api/unicode.html#Py_UCS4> * PyUnicode_4BYTE_DATA(PyObject<http://docs.python.org/dev/c-api/structures.html#PyObject> * *o*) <http://docs.python.org/dev/c-api/unicode.html#PyUnicode_4BYTE_DATA> Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 integer types for direct character access. No checks are performed if the canonical representation has the correct character size; use PyUnicode_KIND()<http://docs.python.org/dev/c-api/unicode.html#PyUnicode_KIND> to select the right macro. Make sure PyUnicode_READY()<http://docs.python.org/dev/c-api/unicode.html#PyUnicode_READY> has been called before accessing this. New in version 3.3. PyUnicode_WCHAR_KIND<http://docs.python.org/dev/c-api/unicode.html#PyUnicode_WCHAR_KIND> PyUnicode_1BYTE_KIND<http://docs.python.org/dev/c-api/unicode.html#PyUnicode_1BYTE_KIND> PyUnicode_2BYTE_KIND<http://docs.python.org/dev/c-api/unicode.html#PyUnicode_2BYTE_KIND> PyUnicode_4BYTE_KIND<http://docs.python.org/dev/c-api/unicode.html#PyUnicode_4BYTE_KIND> Return values of the PyUnicode_KIND()<http://docs.python.org/dev/c-api/unicode.html#PyUnicode_KIND> macro. New in version 3.3. int PyUnicode_KIND(PyObject<http://docs.python.org/dev/c-api/structures.html#PyObject> * *o*) <http://docs.python.org/dev/c-api/unicode.html#PyUnicode_KIND> Return one of the PyUnicode kind constants (see above) that indicate how many bytes per character this Unicode object uses to store its data. *o* has to be a Unicode object in the “canonical” representation (not checked). New in version 3.3. -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo

Lack a API WCHAR* PyUnicode_WCHAR_DATA(PyObject *o), This is important for OS dependent feature port.
Why can't you use the existing wchar_t functions: http://docs.python.org/dev/c-api/unicode.html#wchar-t-support ? Regards Antoine.

It's not a lack, it's a design choice. Unicode strings are no more stored as wchar_t* in Python 3.3, but as a compact storage (1, 2 or 4 bytes per character). The conversion to wchar_t* require a conversion in most cases (no conversion is needed if the string already uses sizeof(wchar_t) bytes per character).

Lack a API WCHAR* PyUnicode_WCHAR_DATA(PyObject *o), This is important for OS dependent feature port.
Why can't you use the existing wchar_t functions: http://docs.python.org/dev/c-api/unicode.html#wchar-t-support ? Regards Antoine.

It's not a lack, it's a design choice. Unicode strings are no more stored as wchar_t* in Python 3.3, but as a compact storage (1, 2 or 4 bytes per character). The conversion to wchar_t* require a conversion in most cases (no conversion is needed if the string already uses sizeof(wchar_t) bytes per character).
participants (3)
-
Antoine Pitrou
-
Victor Stinner
-
罗勇刚(Yonggang Luo)