@@ -127,6 +127,10 @@ called with a non-bytes parameter.
127127 Return the bytes representation of object *o * that implements the buffer
128128 protocol.
129129
130+ .. note ::
131+ If the object implements the buffer protocol, then the buffer
132+ must not be mutated while the bytes object is being created.
133+
130134
131135.. c :function :: Py_ssize_t PyBytes_Size (PyObject *o)
132136
@@ -185,13 +189,20 @@ called with a non-bytes parameter.
185189 created, the old reference to *bytes * will still be discarded and the value
186190 of *\* bytes * will be set to ``NULL ``; the appropriate exception will be set.
187191
192+ .. note ::
193+ If *newpart * implements the buffer protocol, then the buffer
194+ must not be mutated while the new bytes object is being created.
188195
189196.. c :function :: void PyBytes_ConcatAndDel (PyObject **bytes, PyObject *newpart)
190197
191198 Create a new bytes object in *\* bytes * containing the contents of *newpart *
192199 appended to *bytes *. This version releases the :term: `strong reference `
193200 to *newpart * (i.e. decrements its reference count).
194201
202+ .. note::
203+ If *newpart* implements the buffer protocol, then the buffer
204+ must not be mutated while the new bytes object is being created.
205+
195206
196207.. c:function:: PyObject* PyBytes_Join(PyObject *sep, PyObject *iterable)
197208
@@ -210,6 +221,9 @@ called with a non-bytes parameter.
210221
211222 .. versionadded:: 3.14
212223
224+ .. note::
225+ If *iterable* objects implement the buffer protocol, then the buffers
226+ must not be mutated while the new bytes object is being created.
213227
214228.. c:function:: int _PyBytes_Resize(PyObject **bytes, Py_ssize_t newsize)
215229
0 commit comments