Skip to content

Commit 9159bfa

Browse files
committed
increase refcnt of returned item
1 parent a6e4c5f commit 9159bfa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

graalpython/benchmarks/src/micro/c-call-classmethod.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@
4545
} NativeCustomObject;
4646
4747
PyObject* nc_classmethod(PyObject* class, PyObject* args) {
48-
return PyTuple_GET_ITEM(args, 0);
48+
PyObject* item = PyTuple_GET_ITEM(args, 0);
49+
Py_INCREF(item);
50+
return item;
4951
}
5052
5153
static struct PyMethodDef nc_methods[] = {
@@ -140,4 +142,3 @@ def measure(num):
140142

141143
def __benchmark__(num=1000000):
142144
measure(num)
143-

0 commit comments

Comments
 (0)