On failure, return ``NULL`` with an exception set.
+ .. note::
+ If the object implements the buffer protocol, then the buffer
+ must not be mutated while the bytearray object is being created.
+
.. c:function:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)
On failure, return ``NULL`` with an exception set.
+ .. note::
+ If the object implements the buffer protocol, then the buffer
+ must not be mutated while the bytearray object is being created.
+
.. c:function:: Py_ssize_t PyByteArray_Size(PyObject *bytearray)
``NULL`` pointer. The returned array always has an extra
null byte appended.
+ .. note::
+ It is not thread-safe to mutate the bytearray object while using the returned char array.
+
.. c:function:: int PyByteArray_Resize(PyObject *bytearray, Py_ssize_t len)
Similar to :c:func:`PyByteArray_AsString`, but without error checking.
+ .. note::
+ It is not thread-safe to mutate the bytearray object while using the returned char array.
+
.. c:function:: Py_ssize_t PyByteArray_GET_SIZE(PyObject *bytearray)
# Repr - atomic as bytes are immutable
PyBytes_Repr:atomic:
+
+# Creation from object - may call arbitrary code
+PyByteArray_FromObject:shared:
+
+# Creation - pure allocation, no shared state
+PyByteArray_FromStringAndSize:atomic:
+
+# Concatenation - uses buffer protocol; safe as long as buffer is not mutated by another thread during the operation
+PyByteArray_Concat:shared:
+
+# Size - uses atomic load on free-threaded builds
+PyByteArray_Size:atomic:
+PyByteArray_GET_SIZE:atomic:
+
+# Raw data - no locking; mutating it is unsafe if the bytearray object is shared between threads
+PyByteArray_AsString:compatible:
+PyByteArray_AS_STRING:compatible:
\ No newline at end of file