File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -1027,7 +1027,7 @@ array_contains(arrayobject *self, PyObject *v)
10271027 for (i = 0 , cmp = 0 ; cmp == 0 && i < Py_SIZE (self ); i ++ ) {
10281028 PyObject * selfi = getarrayitem ((PyObject * )self , i );
10291029 if (selfi == NULL )
1030- return NULL ;
1030+ return -1 ;
10311031 cmp = PyObject_RichCompareBool (selfi , v , Py_EQ );
10321032 Py_DECREF (selfi );
10331033 }
@@ -1405,13 +1405,16 @@ array_tolist(arrayobject *self, PyObject *unused)
14051405 return NULL ;
14061406 for (i = 0 ; i < Py_SIZE (self ); i ++ ) {
14071407 PyObject * v = getarrayitem ((PyObject * )self , i );
1408- if (v == NULL ) {
1409- Py_DECREF (list );
1410- return NULL ;
1411- }
1412- PyList_SetItem (list , i , v );
1408+ if (v == NULL )
1409+ goto error ;
1410+ if (PyList_SetItem (list , i , v ) < 0 )
1411+ goto error ;
14131412 }
14141413 return list ;
1414+
1415+ error :
1416+ Py_DECREF (list );
1417+ return NULL ;
14151418}
14161419
14171420PyDoc_STRVAR (tolist_doc ,
You can’t perform that action at this time.
0 commit comments