summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2003-05-23 10:01:07 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2003-05-23 10:01:07 (GMT)
commit8bb1ae9c344249e9d22c69cd87077c5d27c3e18f (patch)
tree509b0bc23fe7cf160004f2cea1687d9936d0a47b
parent4ec4fa208e50d0f384ce2bec65c8612cb5029996 (diff)
downloadcpython-8bb1ae9c344249e9d22c69cd87077c5d27c3e18f.zip
cpython-8bb1ae9c344249e9d22c69cd87077c5d27c3e18f.tar.gz
cpython-8bb1ae9c344249e9d22c69cd87077c5d27c3e18f.tar.bz2
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().
-rw-r--r--Modules/arraymodule.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index dcb66cf..f730915 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 && i<ap->ob_size);
return (*ap->ob_descr->getitem)(ap, i);
}