Mercurial > cpython-lru_cache-weakref
diff Modules/arraymodule.c @ 29244:23ad8b5d7b4a legacy-trunk
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().
| author | Walter Dörwald <walter@livinglogic.de> |
|---|---|
| date | Fri, 23 May 2003 10:01:07 +0000 |
| parents | 2bb5ceef9ac3 |
| children | ae0242e3459e |
line wrap: on
line diff
--- a/Modules/arraymodule.c Fri May 23 08:51:51 2003 +0000 +++ b/Modules/arraymodule.c Fri May 23 10:01:07 2003 +0000 @@ -447,10 +447,7 @@ 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); }
