PyUnicode_Resize

Resize an already allocated Unicode object to the new size length.

_*unicode is modified to point to the new (resized) object and 0 returned on success.

This API may only be called by the function which also called the Unicode constructor. The refcount on the object must be 1. Otherwise, an error is returned.

Error handling is implemented as follows: an exception is set, -1 is returned and *unicode left untouched.

  1. int PyUnicode_Resize(PyObject** unicode, Py_ssize_t length)
    version(Python_3_3_Or_Later)
    extern (C)
    int
    PyUnicode_Resize
  2. alias PyUnicode_Resize = PyUnicodeUCS2_Resize
  3. alias PyUnicode_Resize = PyUnicodeUCS4_Resize

Parameters

unicode PyObject**

pointer to the new unicode object.

length Py_ssize_t

New length.

Meta