Skip to content

Commit 86e9a3a

Browse files
committed
[GR-58707] avoid reading a tuple if an exception happens
the exception can happen during transition from managed to native
1 parent b7a6d33 commit 86e9a3a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,5 +1418,9 @@ PyTruffleTuple_GetItems(PyObject *op)
14181418
*/
14191419
PyObject*
14201420
_PyTuple_GET_ITEM(PyObject* a, Py_ssize_t b) {
1421-
return PyTruffleTuple_GetItems(a)[b];
1421+
PyObject **ob_item = PyTruffleTuple_GetItems(a);
1422+
if (ob_item) {
1423+
return ob_item[b];
1424+
}
1425+
return NULL; // an exception has happend during transtion
14221426
}

0 commit comments

Comments
 (0)