Skip to content

Commit ab9c64f

Browse files
authored
Merge pull request #105 from static-frame/104/isna-element-decref
Corrected leak in `isna_element`
2 parents e2cd12c + 95f1ca6 commit ab9c64f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/_arraykit.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3771,10 +3771,14 @@ isna_element(PyObject *m, PyObject *args, PyObject *kwargs)
37713771
// Try to identify Pandas Timestamp NATs
37723772
if (PyObject_HasAttrString(element, "to_numpy")) {
37733773
PyObject *to_numpy = PyObject_GetAttrString(element, "to_numpy");
3774+
if (to_numpy == NULL) {
3775+
return NULL;
3776+
}
37743777
if (!PyCallable_Check(to_numpy)) {
37753778
Py_RETURN_FALSE;
37763779
}
37773780
PyObject* post = PyObject_CallFunction(to_numpy, NULL);
3781+
Py_DECREF(to_numpy);
37783782
if (post == NULL) return NULL;
37793783
return PyBool_FromLong(PyArrayScalar_VAL(post, Datetime) == NPY_DATETIME_NAT);
37803784
}

0 commit comments

Comments
 (0)