[Numpy-svn] r3188 - trunk/numpy/core/src

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Sep 19 08:19:20 CDT 2006


Author: pearu
Date: 2006-09-19 08:19:07 -0500 (Tue, 19 Sep 2006)
New Revision: 3188

Modified:
   trunk/numpy/core/src/arrayobject.c
Log:
Fixed compiler errors when using Python 2.5rc.

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-09-19 08:44:44 UTC (rev 3187)
+++ trunk/numpy/core/src/arrayobject.c	2006-09-19 13:19:07 UTC (rev 3188)
@@ -563,7 +563,11 @@
         }
 #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 @@
         }
 #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 @@
     }
 #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;



More information about the Numpy-svn mailing list