Skip to content
Merged
Next Next commit
gh-129107: make bytearray free-thread safe
  • Loading branch information
tom-pytel committed Jan 20, 2025
commit ebdd6b7e60601d2eaeb882b046849cf63d9f6167
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));
Comment thread
sobolevn marked this conversation as resolved.
#else
return Py_SIZE(self);
#endif
}
#define PyByteArray_GET_SIZE(self) PyByteArray_GET_SIZE(_PyObject_CAST(self))
Loading