diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 778ee9890c5a82..eacd24e3c7d920 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -730,6 +730,19 @@ APIs: .. versionadded:: 3.3 +.. c:function:: int PyUnicode_Resize(PyObject **p_unicode, Py_ssize_t length) + + Resize a Unicode object to the new *length* in code points. ``*p_unicode`` + must point to a strong reference to a new, unshared Unicode object. + + The string must not have been “used” yet. + See :c:func:`PyUnicode_New` for details. + + Return ``0`` on success, or ``-1`` on error with an exception set. + + .. versionadded:: 2.7 + + .. c:function:: Py_UCS4* PyUnicode_AsUCS4(PyObject *unicode, Py_UCS4 *buffer, \ Py_ssize_t buflen, int copy_null) diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat index 47b417eed6efda..b32baab32d589d 100644 --- a/Doc/data/refcounts.dat +++ b/Doc/data/refcounts.dat @@ -2659,6 +2659,10 @@ PyUnicode_Partition:PyObject*::+1: PyUnicode_Partition:PyObject*:unicode:0: PyUnicode_Partition:PyObject*:sep:0: +PyUnicode_Resize:int::: +PyUnicode_Resize:PyObject*:p_unicode:0: +PyUnicode_Resize:Py_ssize_t:length:: + PyUnicode_RPartition:PyObject*::+1: PyUnicode_RPartition:PyObject*:unicode:0: PyUnicode_RPartition:PyObject*:sep:0: