diff options
author | Travis Oliphant <oliphant@enthought.com> | 2007-04-02 20:21:57 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2007-04-02 20:21:57 +0000 |
commit | 1cd5403e91c066910c85d1e326cffa701c7e5101 (patch) | |
tree | 54b20112542b63167cd2a2246bbcec36048a6c6d /numpy/core/src/arraymethods.c | |
parent | a1f65e154f15f1c5b35c2befaeb74f3952b2c3e2 (diff) | |
download | numpy-1cd5403e91c066910c85d1e326cffa701c7e5101.tar.gz |
Add interp to numpy.lib adapted from arrayfns. Add an unfinished arrayfns compatibility module to old_numeric.
Diffstat (limited to 'numpy/core/src/arraymethods.c')
-rw-r--r-- | numpy/core/src/arraymethods.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/src/arraymethods.c b/numpy/core/src/arraymethods.c index e2dbaa717..3572633ef 100644 --- a/numpy/core/src/arraymethods.c +++ b/numpy/core/src/arraymethods.c @@ -479,7 +479,9 @@ array_toscalar(PyArrayObject *self, PyObject *args) { PyErr_SetString(PyExc_ValueError, "invalid integer"); return NULL; } - if (value >= PyArray_SIZE(self)) { + factor = PyArray_SIZE(self); + if (value < 0) value += factor; + if ((value >= factor) || (value < 0)) { PyErr_SetString(PyExc_ValueError, "index out of bounds"); return NULL; |