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

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Oct 23 17:22:44 CDT 2006


Author: oliphant
Date: 2006-10-23 17:22:41 -0500 (Mon, 23 Oct 2006)
New Revision: 3384

Modified:
   trunk/numpy/core/src/arrayobject.c
Log:
Don't allow builtin data-type objects to be deallocated.

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-10-23 22:03:14 UTC (rev 3383)
+++ trunk/numpy/core/src/arrayobject.c	2006-10-23 22:22:41 UTC (rev 3384)
@@ -10562,6 +10562,13 @@
 static void
 arraydescr_dealloc(PyArray_Descr *self)
 {
+        if (self->fields == Py_None) {
+                fprintf(stderr, "*** Reference count error detected: \n" \
+                        "an attempt was made to deallocate %d (%c) ***\n", 
+                        self->type_num, self->type);
+                Py_INCREF(self);
+                return;
+        }
         Py_XDECREF(self->typeobj);
         Py_XDECREF(self->names);
         Py_XDECREF(self->fields);



More information about the Numpy-svn mailing list