Skip to content

Commit d4d1829

Browse files
committed
REF: No need to XDECREF, added a comment as Michael suggested.
1 parent 2171fed commit d4d1829

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

devsupApp/src/dbfield.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,8 @@ static PyObject* build_array(PyObject* obj, void *data, unsigned short ftype, un
105105
PyDataType_SET_ELSIZE(desc, MAX_STRING_SIZE);
106106
}
107107

108-
Py_XINCREF(desc);
109-
PyObject *out_arr = PyArray_NewFromDescr(&PyArray_Type, desc, ndims, dims, NULL, data, flags, (PyObject*)obj);
110-
if(!out_arr) {
111-
Py_XDECREF(desc);
112-
return NULL;
113-
}
114-
return out_arr;
108+
Py_XINCREF(desc); // take a reference for PyArray_NewFromDescr() to steal
109+
return PyArray_NewFromDescr(&PyArray_Type, desc, ndims, dims, NULL, data, flags, (PyObject*)obj);
115110
#else
116111
PyErr_SetNone(PyExc_NotImplementedError);
117112
return NULL;

0 commit comments

Comments
 (0)