8000 Update · python/cpython@8f187ff · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f187ff

Browse files
committed
Update
1 parent f2cd85c commit 8f187ff

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Objects/listobject.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,8 @@ list_contains(PyObject *aa, PyObject *el)
650650
static inline PyObject *
651651
list_item_try_lock_free(PyListObject *a, Py_ssize_t i)
652652
{
653-
PyObject **ob_item = FT_ATOMIC_LOAD_PTR(a->ob_item);
654-
PyObject *item = FT_ATOMIC_LOAD_PTR(ob_item[i]);
653+
PyObject **ob_item = _Py_atomic_load_ptr(&a->ob_item);
654+
PyObject *item = _Py_atomic_load_ptr(&ob_item[i]);
655655
if (!item || !_Py_TryIncrefCompare(&ob_item[i], item)) {
656656
return NULL;
657657
}
@@ -662,13 +662,15 @@ static PyObject *
662662
list_item(PyObject *aa, Py_ssize_t i)
663663
{
664664
PyListObject *a = (PyListObject *)aa;
665+
PyObject *item;
665666
if (!valid_index(i, PyList_GET_SIZE(a))) {
666667
PyErr_SetObject(PyExc_IndexError, &_Py_STR(list_err));
667668
return NULL;
668669
}
669670
#ifdef Py_GIL_DISABLED
670-
PyObject *item = list_item_try_lock_free(a, i);
671-
if (item != NULL) {
671+
PyObject **ob_item = _Py_atomic_load_ptr(&a->ob_item);
672+
item = _Py_atomic_load_ptr(&ob_item[i]);
673+
if (item && _Py_TryIncrefCompare(&ob_item[i], item)) {
672674
goto end;
673675
}
674676
#endif

0 commit comments

Comments
 (0)
0