Skip to content

Commit 799205d

Browse files
mknkmyzkmrkn
authored andcommitted
Cope with numpy memleak (e.g. np.array([1,2,3]) < 1)
1 parent 8f76306 commit 799205d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/pycall/pycall.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,9 @@ pycall_libpython_helpers_m_compare(VALUE mod, VALUE op, VALUE pyptr_a, VALUE pyp
792792
if (!res) {
793793
pycall_pyerror_fetch_and_raise("PyObject_RichCompare in pycall_libpython_helpers_m_compare");
794794
}
795-
796-
return pycall_pyobject_to_ruby(res);
795+
VALUE obj = pycall_pyobject_to_ruby(res);
796+
pycall_Py_DecRef(res);
797+
return obj;
797798
}
798799

799800
static int is_pyobject_wrapper(VALUE obj);

0 commit comments

Comments
 (0)