@@ -123,6 +123,10 @@ called with a non-bytes parameter.
123123 Return the bytes representation of object *o * that implements the buffer
124124 protocol.
125125
126+ .. note ::
127+ If the object implements the buffer protocol, then the buffer
128+ must not be mutated while the bytes object is being created.
129+
126130
127131.. c :function :: Py_ssize_t PyBytes_Size (PyObject *o)
128132
@@ -181,13 +185,20 @@ called with a non-bytes parameter.
181185 created, the old reference to *bytes * will still be discarded and the value
182186 of *\* bytes * will be set to ``NULL ``; the appropriate exception will be set.
183187
188+ .. note ::
189+ If *newpart * implements the buffer protocol, then the buffer
190+ must not be mutated while the new bytes object is being created.
184191
185192.. c :function :: void PyBytes_ConcatAndDel (PyObject **bytes, PyObject *newpart)
186193
187194 Create a new bytes object in *\* bytes * containing the contents of *newpart *
188195 appended to *bytes *. This version releases the :term: `strong reference `
189196 to *newpart * (i.e. decrements its reference count).
190197
198+ .. note::
199+ If *newpart* implements the buffer protocol, then the buffer
200+ must not be mutated while the new bytes object is being created.
201+
191202
192203.. c:function:: PyObject* PyBytes_Join(PyObject *sep, PyObject *iterable)
193204
@@ -206,6 +217,9 @@ called with a non-bytes parameter.
206217
207218 .. versionadded:: 3.14
208219
220+ .. note::
221+ If *iterable* objects implement the buffer protocol, then the buffers
222+ must not be mutated while the new bytes object is being created.
209223
210224.. c:function:: int _PyBytes_Resize(PyObject **bytes, Py_ssize_t newsize)
211225
0 commit comments