diff options
Diffstat (limited to 'Include')
-rw-r--r-- | Include/cpython/unicodeobject.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Include/cpython/unicodeobject.h b/Include/cpython/unicodeobject.h index 54a13e3..be91d2d 100644 --- a/Include/cpython/unicodeobject.h +++ b/Include/cpython/unicodeobject.h @@ -734,6 +734,19 @@ PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *s, unsigned int kind); /* --- Manage the default encoding ---------------------------------------- */ +/* Get a buffer to the UTF-8 encoding of the Unicode object unicode. + Returns -1 on error. + + Successful calls must be paired to + calls to PyBuffer_Release. +*/ + +PyAPI_FUNC(int) _PyUnicode_GetUTF8Buffer( + PyObject *unicode, /* Unicode object */ + const char *errors, /* error handling */ + Py_buffer *view /* (out) buffer to the UTF-8 encoding */ + ); + /* Returns a pointer to the default encoding (UTF-8) of the Unicode object unicode and the size of the encoded representation in bytes stored in *size. @@ -746,12 +759,6 @@ PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *s, unsigned int kind); _PyUnicode_AsStringAndSize is a #define for PyUnicode_AsUTF8AndSize to support the previous internal function with the same behaviour. - - *** This API is for interpreter INTERNAL USE ONLY and will likely - *** be removed or changed in the future. - - *** If you need to access the Unicode object as UTF-8 bytes string, - *** please use PyUnicode_AsUTF8String() instead. */ PyAPI_FUNC(const char *) PyUnicode_AsUTF8AndSize( |