summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-10-23 22:22:41 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-10-23 22:22:41 +0000
commitb98a6d71088106d422994687c871cf51389cde39 (patch)
tree2cb77f2235275f32ffd597a6c6e4b08820ec7abd /numpy/core/src/arrayobject.c
parent440a2627ac7d15de4b765279ce7546e66ddfa780 (diff)
downloadnumpy-b98a6d71088106d422994687c871cf51389cde39.tar.gz
Don't allow builtin data-type objects to be deallocated.
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index 2aea422ae..c283c3eb7 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -10562,6 +10562,13 @@ PyArray_DescrNew(PyArray_Descr *base)
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);