File tree 1 file changed +5
-10
lines changed
1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -351,7 +351,11 @@ list_item_impl(PyListObject *self, Py_ssize_t idx)
351
351
if (!valid_index (idx , size )) {
352
352
goto exit ;
353
353
}
354
+ #ifdef Py_GIL_DISABLED
355
+ item = _Py_NewRefWithLock (self -> ob_item [idx ]);
356
+ #else
354
357
item = Py_NewRef (self -> ob_item [idx ]);
358
+ #endif
355
359
exit :
356
360
Py_END_CRITICAL_SECTION ();
357
361
return item ;
@@ -655,16 +659,7 @@ list_item(PyObject *aa, Py_ssize_t i)
655
659
PyErr_SetObject (PyExc_IndexError , & _Py_STR (list_err ));
656
660
return NULL ;
657
661
}
658
- PyObject * item ;
659
- Py_BEGIN_CRITICAL_SECTION (a );
660
- #ifdef Py_GIL_DISABLED
661
- if (!_Py_IsOwnedByCurrentThread ((PyObject * )a ) && !_PyObject_GC_IS_SHARED (a )) {
662
- _PyObject_GC_SET_SHARED (a );
663
- }
664
- #endif
665
- item = Py_NewRef (a -> ob_item [i ]);
666
- Py_END_CRITICAL_SECTION ();
667
- return item ;
662
+ return list_get_item_ref (a , i );
668
663
}
669
664
670
665
static PyObject *
You can’t perform that action at this time.
0 commit comments