Skip to content

Commit 1069a64

Browse files
committed
atomic PyByteArray_GET_SIZE
1 parent 8a1edd8 commit 1069a64

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Include/cpython/bytearrayobject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ static inline char* PyByteArray_AS_STRING(PyObject *op)
2929

3030
static inline Py_ssize_t PyByteArray_GET_SIZE(PyObject *op) {
3131
PyByteArrayObject *self = _PyByteArray_CAST(op);
32+
#ifdef Py_GIL_DISABLED
33+
return _Py_atomic_load_ssize_relaxed(&(_PyVarObject_CAST(self)->ob_size));
34+
#else
3235
return Py_SIZE(self);
36+
#endif
3337
}
3438
#define PyByteArray_GET_SIZE(self) PyByteArray_GET_SIZE(_PyObject_CAST(self))

0 commit comments

Comments
 (0)