diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2006-09-19 13:19:07 +0000 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2006-09-19 13:19:07 +0000 |
commit | 60d18d232dde5317b0ba84893339c6e0c316f596 (patch) | |
tree | a5fe3c7414480797edc2512d66968d00771d2ebb /numpy/core | |
parent | f54a116f84b82b4679dd803728d2fa08491ea613 (diff) | |
download | numpy-60d18d232dde5317b0ba84893339c6e0c316f596.tar.gz |
Fixed compiler errors when using Python 2.5rc.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/arrayobject.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index ebd122501..2a2f48711 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -563,7 +563,11 @@ PyArray_PyIntAsIntp(PyObject *o) } #if (PY_VERSION_HEX >= 0x02050000) if (PyIndex_Check(o)) { - long_value = (longlong) PyNumber_Index(o); + PyObject* value = PyNumber_Index(o); + if (value==NULL) { + return -1; + } + long_value = (longlong) PyInt_AsSsize_t(value); goto finish; } #endif @@ -652,7 +656,8 @@ PyArray_PyIntAsInt(PyObject *o) } #if (PY_VERSION_HEX >= 0x02050000) if (PyIndex_Check(o)) { - long_value = (longlong) PyNumber_Index(o); + PyObject* value = PyNumber_Index(o); + long_value = (longlong) PyInt_AsSsize_t(value); goto finish; } #endif @@ -3393,8 +3398,14 @@ array_power_is_scalar(PyObject *o2, double* exp) } #if (PY_VERSION_HEX >= 0x02050000) if (PyIndex_Check(o2)) { + PyObject* value = PyNumber_Index(o2); Py_ssize_t val; - val = PyNumber_Index(obj); + if (value==NULL) { + if (PyErr_Occurred()) + PyErr_Clear(); + return 0; + } + val = PyInt_AsSsize_t(value); if (val == -1 && PyErr_Occurred()) { PyErr_Clear(); return 0; |