mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
gh-129107: make bytearray thread safe (#129108)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
d2e60d8e59
commit
a05433f24a
5 changed files with 904 additions and 100 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue