]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
All calls to getarrayitem() (which is static) are done either in loops
authorWalter Dörwald <walter@livinglogic.de>
Fri, 23 May 2003 10:01:07 +0000 (10:01 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Fri, 23 May 2003 10:01:07 +0000 (10:01 +0000)
over the size of the array, or the callers check the index bounds themselves,
so the index check never failed => Replace it with an assert().

Modules/arraymodule.c

index dcb66cf0a89da388718008620b4de4bcd6f4be43..f730915151add782fd4d4728eaa1d6209c2c8d7a 100644 (file)
@@ -447,10 +447,7 @@ getarrayitem(PyObject *op, int i)
        register arrayobject *ap;
        assert(array_Check(op));
        ap = (arrayobject *)op;
-       if (i < 0 || i >= ap->ob_size) {
-               PyErr_SetString(PyExc_IndexError, "array index out of range");
-               return NULL;
-       }
+       assert(i>=0 && i<ap->ob_size);
        return (*ap->ob_descr->getitem)(ap, i);
 }