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

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Aug 22 02:11:05 EDT 2008


Author: jarrod.millman
Date: 2008-08-22 01:11:00 -0500 (Fri, 22 Aug 2008)
New Revision: 5673

Modified:
   trunk/numpy/core/include/numpy/ndarrayobject.h
   trunk/numpy/core/src/arrayobject.c
   trunk/numpy/core/src/multiarraymodule.c
Log:
reverting C-API change from r5626


Modified: trunk/numpy/core/include/numpy/ndarrayobject.h
===================================================================
--- trunk/numpy/core/include/numpy/ndarrayobject.h	2008-08-21 19:45:02 UTC (rev 5672)
+++ trunk/numpy/core/include/numpy/ndarrayobject.h	2008-08-22 06:11:00 UTC (rev 5673)
@@ -39,7 +39,7 @@
 #define NPY_SUCCEED 1
 
         /* Helpful to distinguish what is installed */
-#define NPY_VERSION 0x0100000A
+#define NPY_VERSION 0x01000009
 
         /* Some platforms don't define bool, long long, or long double.
            Handle that here.
@@ -1176,7 +1176,7 @@
                                 NPY_NEEDS_INIT | NPY_NEEDS_PYAPI)
 
 #define PyDataType_FLAGCHK(dtype, flag)                                   \
-        (((dtype)->flags & (flag)) == (flag))
+        (((dtype)->hasobject & (flag)) == (flag))
 
 #define PyDataType_REFCHK(dtype)                                          \
         PyDataType_FLAGCHK(dtype, NPY_ITEM_REFCOUNT)
@@ -1192,7 +1192,7 @@
         char type;              /* unique-character representing this type */
         char byteorder;         /* '>' (big), '<' (little), '|'
                                    (not-applicable), or '=' (native). */
-        int flags;              /* non-zero if it has object arrays
+        char hasobject;         /* non-zero if it has object arrays
                                    in fields */
         int type_num;          /* number representing this type */
         int elsize;             /* element size for this type */

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2008-08-21 19:45:02 UTC (rev 5672)
+++ trunk/numpy/core/src/arrayobject.c	2008-08-22 06:11:00 UTC (rev 5673)
@@ -11156,7 +11156,7 @@
     {"byteorder", T_CHAR, offsetof(PyArray_Descr, byteorder), RO, NULL},
     {"itemsize", T_INT, offsetof(PyArray_Descr, elsize), RO, NULL},
     {"alignment", T_INT, offsetof(PyArray_Descr, alignment), RO, NULL},
-    {"flags", T_UBYTE, offsetof(PyArray_Descr, flags), RO, NULL},
+    {"flags", T_UBYTE, offsetof(PyArray_Descr, hasobject), RO, NULL},
     {NULL},
 };
 
@@ -11556,7 +11556,7 @@
 
     PyTuple_SET_ITEM(state, 5, PyInt_FromLong(elsize));
     PyTuple_SET_ITEM(state, 6, PyInt_FromLong(alignment));
-    PyTuple_SET_ITEM(state, 7, PyInt_FromLong(self->flags));
+    PyTuple_SET_ITEM(state, 7, PyInt_FromLong(self->hasobject));
 
     PyTuple_SET_ITEM(ret, 2, state);
     return ret;
@@ -11568,8 +11568,7 @@
 static int
 _descr_find_object(PyArray_Descr *self)
 {
-    if (PyDataType_FLAGCHK(self, NPY_ITEM_HASOBJECT) || 
-	self->type_num == PyArray_OBJECT ||
+    if (self->hasobject || self->type_num == PyArray_OBJECT ||
         self->kind == 'O')
         return NPY_OBJECT_DTYPE_FLAGS;
     if (PyDescr_HASFIELDS(self)) {
@@ -11585,7 +11584,7 @@
                 return 0;
             }
             if (_descr_find_object(new)) {
-                new->flags = NPY_OBJECT_DTYPE_FLAGS;
+                new->hasobject = NPY_OBJECT_DTYPE_FLAGS;
                 return NPY_OBJECT_DTYPE_FLAGS;
             }
         }
@@ -11716,9 +11715,9 @@
         self->alignment = alignment;
     }
 
-    self->flags = dtypeflags;
+    self->hasobject = dtypeflags;
     if (version < 3) {
-        self->flags = _descr_find_object(self);
+        self->hasobject = _descr_find_object(self);
     }
     Py_INCREF(Py_None);
     return Py_None;

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2008-08-21 19:45:02 UTC (rev 5672)
+++ trunk/numpy/core/src/multiarraymodule.c	2008-08-22 06:11:00 UTC (rev 5673)
@@ -4704,7 +4704,7 @@
         new->names = conv->names;
         Py_XINCREF(new->names);
     }
-    new->flags = conv->flags;
+    new->hasobject = conv->hasobject;
     Py_DECREF(conv);
     *errflag = 0;
     return new;
@@ -4783,7 +4783,7 @@
         PyDimMem_FREE(shape.ptr);
         newdescr->subarray = _pya_malloc(sizeof(PyArray_ArrayDescr));
         newdescr->subarray->base = type;
-        newdescr->flags = type->flags;
+        newdescr->hasobject = type->hasobject;
         Py_INCREF(val);
         newdescr->subarray->shape = val;
         Py_XDECREF(newdescr->fields);
@@ -4873,7 +4873,7 @@
                             "two fields with the same name");
             goto fail;
         }
-        dtypeflags |= (conv->flags & NPY_FROM_FIELDS);
+        dtypeflags |= (conv->hasobject & NPY_FROM_FIELDS);
         tup = PyTuple_New((title == NULL ? 2 : 3));
         PyTuple_SET_ITEM(tup, 0, (PyObject *)conv);
         if (align) {
@@ -4902,7 +4902,7 @@
     new->fields = fields;
     new->names = nameslist;
     new->elsize = totalsize;
-    new->flags=dtypeflags;
+    new->hasobject=dtypeflags;
     if (maxalign > 1) {
         totalsize = ((totalsize+maxalign-1)/maxalign)*maxalign;
     }
@@ -4955,7 +4955,7 @@
             Py_DECREF(key);
             goto fail;
         }
-        dtypeflags |= (conv->flags & NPY_FROM_FIELDS);
+        dtypeflags |= (conv->hasobject & NPY_FROM_FIELDS);
         PyTuple_SET_ITEM(tup, 0, (PyObject *)conv);
         if (align) {
             int _align;
@@ -4973,7 +4973,7 @@
     new = PyArray_DescrNewFromType(PyArray_VOID);
     new->fields = fields;
     new->names = nameslist;
-    new->flags=dtypeflags;
+    new->hasobject=dtypeflags;
     if (maxalign > 1) {
         totalsize = ((totalsize+maxalign-1)/maxalign)*maxalign;
     }
@@ -5199,7 +5199,7 @@
         }
         Py_DECREF(tup);
         if ((ret == PY_FAIL) || (newdescr->elsize == 0)) goto fail;
-        dtypeflags |= (newdescr->flags & NPY_FROM_FIELDS);
+        dtypeflags |= (newdescr->hasobject & NPY_FROM_FIELDS);
         totalsize += newdescr->elsize;
     }
 
@@ -5217,7 +5217,7 @@
     }
     new->names = names;
     new->fields = fields;
-    new->flags = dtypeflags;
+    new->hasobject = dtypeflags;
     return new;
 
  fail:




More information about the Numpy-svn mailing list