[Numpy-svn] r3126 - in trunk/numpy/core: include/numpy src

numpy-svn at scipy.org numpy-svn at scipy.org
Wed Sep 6 17:49:53 CDT 2006


Author: oliphant
Date: 2006-09-06 17:49:46 -0500 (Wed, 06 Sep 2006)
New Revision: 3126

Modified:
   trunk/numpy/core/include/numpy/ndarrayobject.h
   trunk/numpy/core/src/arrayobject.c
Log:
Code clean-up

Modified: trunk/numpy/core/include/numpy/ndarrayobject.h
===================================================================
--- trunk/numpy/core/include/numpy/ndarrayobject.h	2006-09-06 15:33:22 UTC (rev 3125)
+++ trunk/numpy/core/include/numpy/ndarrayobject.h	2006-09-06 22:49:46 UTC (rev 3126)
@@ -1223,7 +1223,6 @@
         npy_intp              bscoord[NPY_MAXDIMS];
 
         PyObject              *indexobj;               /* creating obj */
-        int                   view;
         int                   consec;
         char                  *dataptr;
 

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-09-06 15:33:22 UTC (rev 3125)
+++ trunk/numpy/core/src/arrayobject.c	2006-09-06 22:49:46 UTC (rev 3126)
@@ -2526,7 +2526,8 @@
                 for (i=0; i<n; i++) {
                         obj = PyTuple_GET_ITEM(args,i);
                         if (PyArray_Check(obj)) {
-                                if (PyArray_ISINTEGER(obj) || PyArray_ISBOOL(obj))
+                                if (PyArray_ISINTEGER(obj) || 
+                                    PyArray_ISBOOL(obj))
                                         retval = SOBJ_ISFANCY;
                                 else {
                                         retval = SOBJ_BADARRAY;
@@ -2558,7 +2559,8 @@
                         obj = PySequence_GetItem(args, i);
                         if (obj == NULL) return SOBJ_ISFANCY;
                         if (PyArray_Check(obj)) {
-                                if (PyArray_ISINTEGER(obj))
+                                if (PyArray_ISINTEGER(obj) ||
+                                    PyArray_ISBOOL(obj))
                                         retval = SOBJ_LISTTUP;
                                 else
                                         retval = SOBJ_BADARRAY;
@@ -2566,8 +2568,8 @@
                         else if (PySequence_Check(obj)) {
                                 retval = SOBJ_LISTTUP;
                         }
-                        else if (PySlice_Check(obj) || obj == Py_Ellipsis || \
-                            obj == Py_None) {
+                        else if (PySlice_Check(obj) || obj == Py_Ellipsis || 
+                                 obj == Py_None) {
                                 retval = SOBJ_NOTFANCY;
                         }
                         Py_DECREF(obj);
@@ -2690,16 +2692,6 @@
                 return NULL;
         }
 
-        if (PyInt_Check(op) || PyArray_IsScalar(op, Integer) ||
-            PyLong_Check(op) || PyIndex_Check(op)) {
-                intp value;
-                value = PyArray_PyIntAsIntp(op);
-                if (!PyErr_Occurred()) {
-                        return array_big_item(self, value);
-                }
-                PyErr_Clear();
-        }
-
         fancy = fancy_indexing_check(op);
 
         if (fancy != SOBJ_NOTFANCY) {
@@ -2846,9 +2838,10 @@
                                 "0-d arrays can't be indexed.");
                 return -1;
         }
-
+        
         /* optimization for integer-tuple */
-        if (self->nd > 1 && (PyTuple_Check(index) && (PyTuple_GET_SIZE(index) == self->nd)) \
+        if (self->nd > 1 && 
+            (PyTuple_Check(index) && (PyTuple_GET_SIZE(index) == self->nd)) 
             && PyArray_IntpFromSequence(index, vals, self->nd) == self->nd) {
                 int i;
                 char *item;



More information about the Numpy-svn mailing list