From b98a6d71088106d422994687c871cf51389cde39 Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Mon, 23 Oct 2006 22:22:41 +0000 Subject: Don't allow builtin data-type objects to be deallocated. --- numpy/core/src/arrayobject.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'numpy/core/src/arrayobject.c') 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); -- cgit v1.2.1