Skip to content
Merged
4 changes: 4 additions & 0 deletions Include/cpython/bytearrayobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ static inline char* PyByteArray_AS_STRING(PyObject *op)

static inline Py_ssize_t PyByteArray_GET_SIZE(PyObject *op) {
PyByteArrayObject *self = _PyByteArray_CAST(op);
#ifdef Py_GIL_DISABLED
return _Py_atomic_load_ssize_relaxed(&(_PyVarObject_CAST(self)->ob_size));
#else
return Py_SIZE(self);
#endif
}
#define PyByteArray_GET_SIZE(self) PyByteArray_GET_SIZE(_PyObject_CAST(self))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make the :type:`bytearray` safe under :term:`free threading`.
Loading
Loading