diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/arraymodule.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 1a59938..8132689 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -767,10 +767,12 @@ array_richcompare(PyObject *v, PyObject *w, int op) k = 1; for (i = 0; i < Py_SIZE(va) && i < Py_SIZE(wa); i++) { vi = getarrayitem(v, i); + if (vi == NULL) { + return NULL; + } wi = getarrayitem(w, i); - if (vi == NULL || wi == NULL) { - Py_XDECREF(vi); - Py_XDECREF(wi); + if (wi == NULL) { + Py_DECREF(vi); return NULL; } k = PyObject_RichCompareBool(vi, wi, Py_EQ); |