mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-121645: Add PyBytes_Join() function (#121646)
* Replace _PyBytes_Join() with PyBytes_Join(). * Keep _PyBytes_Join() as an alias to PyBytes_Join().
This commit is contained in:
parent
7fca268bee
commit
3d60dfbe17
10 changed files with 101 additions and 12 deletions
|
@ -189,6 +189,24 @@ called with a non-bytes parameter.
|
|||
to *newpart* (i.e. decrements its reference count).
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyBytes_Join(PyObject *sep, PyObject *iterable)
|
||||
|
||||
Similar to ``sep.join(iterable)`` in Python.
|
||||
|
||||
*sep* must be Python :class:`bytes` object.
|
||||
(Note that :c:func:`PyUnicode_Join` accepts ``NULL`` separator and treats
|
||||
it as a space, whereas :c:func:`PyBytes_Join` doesn't accept ``NULL``
|
||||
separator.)
|
||||
|
||||
*iterable* must be an iterable object yielding objects that implement the
|
||||
:ref:`buffer protocol <bufferobjects>`.
|
||||
|
||||
On success, return a new :class:`bytes` object.
|
||||
On error, set an exception and return ``NULL``.
|
||||
|
||||
.. versionadded: 3.14
|
||||
|
||||
|
||||
.. c:function:: int _PyBytes_Resize(PyObject **bytes, Py_ssize_t newsize)
|
||||
|
||||
Resize a bytes object. *newsize* will be the new length of the bytes object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue