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

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Oct 31 08:58:22 CST 2006


Author: oliphant
Date: 2006-10-31 08:58:19 -0600 (Tue, 31 Oct 2006)
New Revision: 3422

Modified:
   trunk/numpy/core/src/arrayobject.c
Log:
Revert hasobject to returning True or False

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-10-31 13:28:31 UTC (rev 3421)
+++ trunk/numpy/core/src/arrayobject.c	2006-10-31 14:58:19 UTC (rev 3422)
@@ -10613,9 +10613,6 @@
         {"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},
-        /* Get rid of this in 1.1 */
-        {"hasobject", T_UBYTE, offsetof(PyArray_Descr, hasobject), RO, NULL},
-        /* END */
         {"flags", T_UBYTE, offsetof(PyArray_Descr, hasobject), RO, NULL},
         {"names", T_OBJECT, offsetof(PyArray_Descr, names), RO, NULL},
         {NULL},
@@ -10795,6 +10792,18 @@
         return PyDictProxy_New(self->fields);
 }
 
+static PyObject *
+arraydescr_hasobject_get(PyArray_Descr *self)
+{
+        PyObject *res;
+        if (PyDataType_FLAGCHK(self, NPY_ITEM_HASOBJECT))
+                res = Py_True;
+        else
+                res = Py_False;
+        Py_INCREF(res);
+        return res;
+}
+
 static PyGetSetDef arraydescr_getsets[] = {
         {"subdtype",
          (getter)arraydescr_subdescr_get,
@@ -10822,8 +10831,10 @@
          NULL, NULL},
         {"fields",
          (getter)arraydescr_fields_get,
-         NULL,
-         NULL},
+         NULL, NULL},
+        {"hasobject",
+         (getter)arraydescr_hasobject_get,
+         NULL, NULL},
         {NULL, NULL, NULL, NULL},
 };
 



More information about the Numpy-svn mailing list