From: Walter Dörwald Date: Fri, 23 May 2003 10:01:07 +0000 (+0000) Subject: All calls to getarrayitem() (which is static) are done either in loops X-Git-Tag: v2.3c1~630 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8bb1ae9c344249e9d22c69cd87077c5d27c3e18f;p=thirdparty%2FPython%2Fcpython.git All calls to getarrayitem() (which is static) are done either in loops 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(). --- diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index dcb66cf0a89d..f730915151ad 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -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 && iob_size); return (*ap->ob_descr->getitem)(ap, i); }