File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Open diff view settings
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Open diff view settings
Original file line number Diff line number Diff line change @@ -497,19 +497,18 @@ static PyObject *
497497list_item (PyObject * aa , Py_ssize_t i )
498498{
499499 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 ;
501505 Py_BEGIN_CRITICAL_SECTION (a );
502506#ifdef Py_GIL_DISABLED
503- if (!_PyObject_GC_IS_SHARED (a )) {
507+ if (!_Py_IsOwnedByCurrentThread (( PyObject * ) a ) && ! _PyObject_GC_IS_SHARED (a )) {
504508 _PyObject_GC_SET_SHARED (a );
505509 }
506510#endif
507- if (!valid_index (i , PyList_GET_SIZE (a ))) {
508- PyErr_SetObject (PyExc_IndexError , & _Py_STR (list_err ));
509- goto exit ;
510- }
511511 item = Py_NewRef (a -> ob_item [i ]);
512- exit :
513512 Py_END_CRITICAL_SECTION ();
514513 return item ;
515514}
You can’t perform that action at this time.
0 commit comments