Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 05d0559

Browse filesBrowse files
gh-46236: Add PyUnicode_Resize() doc (#132628)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent d0660a9 commit 05d0559
Copy full SHA for 05d0559

File tree

Expand file treeCollapse file tree

2 files changed

+19
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+19
-0
lines changed

‎Doc/c-api/unicode.rst

Copy file name to clipboardExpand all lines: Doc/c-api/unicode.rst
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,21 @@ APIs:
674674
.. versionadded:: 3.3
675675
676676
677+
.. c:function:: int PyUnicode_Resize(PyObject **unicode, Py_ssize_t length);
678+
679+
Resize a Unicode object *\*unicode* to the new *length* in code points.
680+
681+
Try to resize the string in place (which is usually faster than allocating
682+
a new string and copying characters), or create a new string.
683+
684+
*\*unicode* is modified to point to the new (resized) object and ``0`` is
685+
returned on success. Otherwise, ``-1`` is returned and an exception is set,
686+
and *\*unicode* is left untouched.
687+
688+
The function doesn't check string content, the result may not be a
689+
string in canonical representation.
690+
691+
677692
.. c:function:: Py_ssize_t PyUnicode_Fill(PyObject *unicode, Py_ssize_t start, \
678693
Py_ssize_t length, Py_UCS4 fill_char)
679694

‎Doc/data/refcounts.dat

Copy file name to clipboardExpand all lines: Doc/data/refcounts.dat
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,6 +2794,10 @@ PyUnicode_CopyCharacters:PyObject*:from:0:
27942794
PyUnicode_CopyCharacters:Py_ssize_t:from_start::
27952795
PyUnicode_CopyCharacters:Py_ssize_t:how_many::
27962796

2797+
PyUnicode_Resize:int:::
2798+
PyUnicode_Resize:PyObject**:unicode:0:
2799+
PyUnicode_Resize:Py_ssize_t:length::
2800+
27972801
PyUnicode_Fill:Py_ssize_t:::
27982802
PyUnicode_Fill:PyObject*:unicode:0:
27992803
PyUnicode_Fill:Py_ssize_t:start::

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.