mirror of
https://github.com/python/cpython.git
synced 2025-12-09 02:35:14 +00:00
gh-112087: Make list_repr and list_length to be thread-safe (gh-114582)
This commit is contained in:
parent
699779256e
commit
f9c505698a
2 changed files with 21 additions and 10 deletions
|
|
@ -29,7 +29,11 @@ typedef struct {
|
|||
|
||||
static inline Py_ssize_t PyList_GET_SIZE(PyObject *op) {
|
||||
PyListObject *list = _PyList_CAST(op);
|
||||
#ifdef Py_GIL_DISABLED
|
||||
return _Py_atomic_load_ssize_relaxed(&(_PyVarObject_CAST(list)->ob_size));
|
||||
#else
|
||||
return Py_SIZE(list);
|
||||
#endif
|
||||
}
|
||||
#define PyList_GET_SIZE(op) PyList_GET_SIZE(_PyObject_CAST(op))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue