Skip to content

Commit faadb44

Browse files
rruuaanngencukou
andauthored
gh-46236: Add missing PyUnicode_Append() doc (#130531)
* Add missing PyUnicode_Append() doc * Change the copied content * Add '`` ``' * Change doc * Add PyUnicode_AppendAndDel function doc * Change doc * Add PyUnicode_AppendAndDel to refcounts * Change doc * Change doc Co-authored-by: Petr Viktorin <[email protected]> * Change doc --------- Co-authored-by: Petr Viktorin <[email protected]>
1 parent 33494b4 commit faadb44

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Doc/c-api/unicode.rst

+17
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,23 @@ APIs:
614614
decref'ing the returned objects.
615615
616616
617+
.. c:function:: void PyUnicode_Append(PyObject **p_left, PyObject *right)
618+
619+
Append the string *right* to the end of *p_left*.
620+
*p_left* must point to a :term:`strong reference` to a Unicode object;
621+
:c:func:`!PyUnicode_Append` releases ("steals") this reference.
622+
623+
On error, set *\*p_left* to ``NULL`` and set an exception.
624+
625+
On sucess, set *\*p_left* to a new strong reference to the result.
626+
627+
628+
.. c:function:: void PyUnicode_AppendAndDel(PyObject **p_left, PyObject *right)
629+
630+
The function is similar to :c:func:`PyUnicode_Append`, with the only
631+
difference being that it decrements the reference count of *right* by one.
632+
633+
617634
.. c:function:: const char* PyUnicode_GetDefaultEncoding(void)
618635
619636
Return the name of the default string encoding, ``"utf-8"``.

Doc/data/refcounts.dat

+8
Original file line numberDiff line numberDiff line change
@@ -2770,6 +2770,14 @@ PyUnicode_FromFormatV:PyObject*::+1:
27702770
PyUnicode_FromFormatV:const char*:format::
27712771
PyUnicode_FromFormatV:va_list:args::
27722772

2773+
PyUnicode_Append:void:::
2774+
PyUnicode_Append:PyObject**:p_left:0:
2775+
PyUnicode_Append:PyObject*:right::
2776+
2777+
PyUnicode_AppendAndDel:void:::
2778+
PyUnicode_AppendAndDel:PyObject**:p_left:0:
2779+
PyUnicode_AppendAndDel:PyObject*:right:-1:
2780+
27732781
PyUnicode_GetDefaultEncoding:const char*:::
27742782
PyUnicode_GetDefaultEncoding::void::
27752783

0 commit comments

Comments
 (0)