mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +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
|
@ -1867,11 +1867,19 @@ bytes_join(PyBytesObject *self, PyObject *iterable_of_bytes)
|
|||
}
|
||||
|
||||
PyObject *
|
||||
_PyBytes_Join(PyObject *sep, PyObject *x)
|
||||
PyBytes_Join(PyObject *sep, PyObject *iterable)
|
||||
{
|
||||
assert(sep != NULL && PyBytes_Check(sep));
|
||||
assert(x != NULL);
|
||||
return bytes_join((PyBytesObject*)sep, x);
|
||||
if (sep == NULL) {
|
||||
PyErr_BadInternalCall();
|
||||
return NULL;
|
||||
}
|
||||
if (!PyBytes_Check(sep)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"sep: expected bytes, got %T", sep);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return stringlib_bytes_join(sep, iterable);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue