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

罗勇刚(Yonggang Luo) luoyonggang at gmail.com
Sun Feb 19 19:08:13 CET 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120220/0693f9d3/attachment.html>


More information about the Python-ideas mailing list