STINNER Victor <victor.stin...@haypocalc.com> added the comment: > It seems there's no reason to document these functions > which operate on null-terminated unicode arrays.
It's the easiest way to create a new string with the new Unicode API, when it's difficult to predict the exact output length and maximum character: Py_UCS4 *buffer = PyMem_Malloc(...); ... str = PyUnicode_FromKindAndBuffer(buffer, PyUnicode_4BYTE_KIND); PyMem_Free(buffer); PyUCS4_* functions are useful in the "..." (to write characters, expecially when you manipulate multiple strings). For examples, see Python/import.c which used char*, then Py_UNICODE* and now Py_UCS4*. It's maybe possible to avoid functions like xxx_strlen(), but it was easier to replace str*() functions by Py_UNICODE_* and then PyUCS4_* functions. -- Py_UNICODE_* and PyUCS4_* functions are not part of the stable API. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13246> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com