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))
973
973
if (num == NULL )
974
974
return NULL ;
975
975
976
+ // GraalPy change: for explanation, see similar comment in 'test_k_code'
977
+ #ifdef GRAALVM_PYTHON
978
+ Py_INCREF (num );
979
+ #endif
976
980
PyTuple_SET_ITEM (tuple , 0 , num );
977
981
978
982
value = -1 ;
@@ -1362,6 +1366,15 @@ test_k_code(PyObject *self, PyObject *Py_UNUSED(ignored))
1362
1366
return raiseTestError ("test_k_code" ,
1363
1367
"PyLong_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF" );
1364
1368
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
1365
1378
PyTuple_SET_ITEM (tuple , 0 , num );
1366
1379
1367
1380
value = 0 ;
You can’t perform that action at this time.
0 commit comments