summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
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);