Skip to content

Commit 99d7647

Browse files
committed
Fix: PyObject_Init must do incref on type.
1 parent 6885e24 commit 99d7647

File tree

1 file changed

+7
-0
lines changed
  • graalpython/com.oracle.graal.python.cext/src

1 file changed

+7
-0
lines changed

graalpython/com.oracle.graal.python.cext/src/object.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,13 @@ PyObject* PyObject_Init(PyObject *op, PyTypeObject *tp) {
570570
return PyErr_NoMemory();
571571
}
572572
Py_TYPE(op) = tp;
573+
/* TOOD(fa): properly set HEAPTYPE flag */
574+
/*
575+
if (PyType_GetFlags(tp) & Py_TPFLAGS_HEAPTYPE) {
576+
Py_INCREF(tp);
577+
}
578+
*/
579+
Py_INCREF(tp);
573580
_Py_NewReference(op);
574581
return op;
575582
}

0 commit comments

Comments
 (0)