File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
graalpython/com.oracle.graal.python.cext/modules Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -973,6 +973,10 @@ test_L_code(PyObject *self, PyObject *Py_UNUSED(ignored))
973973 if (num == NULL )
974974 return NULL ;
975975
976+ // GraalPy change: for explanation, see similar comment in 'test_k_code'
977+ #ifdef GRAALVM_PYTHON
978+ Py_INCREF (num );
979+ #endif
976980 PyTuple_SET_ITEM (tuple , 0 , num );
977981
978982 value = -1 ;
@@ -1362,6 +1366,15 @@ test_k_code(PyObject *self, PyObject *Py_UNUSED(ignored))
13621366 return raiseTestError ("test_k_code" ,
13631367 "PyLong_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF" );
13641368
1369+ /*
1370+ * GraalPy change: CPython's tuple is stealing the reference to 'num' which
1371+ * means it just does nothing. In our case, we are internally decref'ing
1372+ * since it is then reference managed. This makes 'num' invalid for the
1373+ * later usage in Py_DECREF. We therefore incref once here.
1374+ */
1375+ #ifdef GRAALVM_PYTHON
1376+ Py_INCREF (num );
1377+ #endif
13651378 PyTuple_SET_ITEM (tuple , 0 , num );
13661379
13671380 value = 0 ;
You can’t perform that action at this time.
0 commit comments