File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Original file line number Diff line number Diff line change @@ -497,19 +497,18 @@ static PyObject *
497
497
list_item (PyObject * aa , Py_ssize_t i )
498
498
{
499
499
PyListObject * a = (PyListObject * )aa ;
500
- PyObject * item = NULL ;
500
+ if (!valid_index (i , PyList_GET_SIZE (a ))) {
501
+ PyErr_SetObject (PyExc_IndexError , & _Py_STR (list_err ));
502
+ return NULL ;
503
+ }
504
+ PyObject * item ;
501
505
Py_BEGIN_CRITICAL_SECTION (a );
502
506
#ifdef Py_GIL_DISABLED
503
- if (!_PyObject_GC_IS_SHARED (a )) {
507
+ if (!_Py_IsOwnedByCurrentThread (( PyObject * ) a ) && ! _PyObject_GC_IS_SHARED (a )) {
504
508
_PyObject_GC_SET_SHARED (a );
505
509
}
506
510
#endif
507
- if (!valid_index (i , PyList_GET_SIZE (a ))) {
508
- PyErr_SetObject (PyExc_IndexError , & _Py_STR (list_err ));
509
- goto exit ;
510
- }
511
511
item = Py_NewRef (a -> ob_item [i ]);
512
- exit :
513
512
Py_END_CRITICAL_SECTION ();
514
513
return item ;
515
514
}
You can’t perform that action at this time.
0 commit comments