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:
Victor Stinner 2024-08-30 14:57:33 +02:00 committed by GitHub
parent 7fca268bee
commit 3d60dfbe17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 101 additions and 12 deletions

View file

@ -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]