Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 committed May 17, 2024
1 parent 02560da commit 1c15fb2
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,21 +657,18 @@ list_item(PyObject *aa, Py_ssize_t i)
return NULL;
}
#ifdef Py_GIL_DISABLED
if (!_Py_IsOwnedByCurrentThread((PyObject *)a) && !_PyObject_GC_IS_SHARED(a)) {
_PyObject_GC_SET_SHARED(a);
}
PyObject **ob_item = _Py_atomic_load_ptr(&a->ob_item);
item = _Py_atomic_load_ptr(&ob_item[i]);
if (item && _Py_TryIncrefCompare(&ob_item[i], item)) {
goto end;
return item;
}
#endif
Py_BEGIN_CRITICAL_SECTION(a);
item = Py_NewRef(a->ob_item[i]);
Py_END_CRITICAL_SECTION();
#ifdef Py_GIL_DISABLED
end:
if (!_Py_IsOwnedByCurrentThread((PyObject *)a) && !_PyObject_GC_IS_SHARED(a)) {
_PyObject_GC_SET_SHARED(a);
}
#endif
return item;
}

Expand Down

0 comments on commit 1c15fb2

Please sign in to comment.