Skip to content

Commit edd0156

Browse files
committed
actually return NULL form Py_BuildValue if there's an error
1 parent 0c6ed34 commit edd0156

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,13 @@ PyObject* _Py_BuildValue_SizeT(const char *format, ...) {
351351
}
352352
case 'S':
353353
case 'N':
354-
if (ARG == NULL && !PyErr_Occurred()) {
355-
/* If a NULL was passed because a call that should have constructed a value failed, that's OK,
356-
* and we pass the error on; but if no error occurred it's not clear that the caller knew what she was doing. */
357-
PyErr_SetString(PyExc_SystemError, "NULL object passed to Py_BuildValue");
354+
if (ARG == NULL) {
355+
if (!PyErr_Occurred()) {
356+
/* If a NULL was passed because a call that should have constructed a value failed, that's OK,
357+
* and we pass the error on; but if no error occurred it's not clear that the caller knew what she was doing. */
358+
PyErr_SetString(PyExc_SystemError, "NULL object passed to Py_BuildValue");
359+
}
360+
return NULL;
358361
} else if (converter != NULL) {
359362
APPEND_VALUE(list, converter(ARG));
360363
converter = NULL;

0 commit comments

Comments
 (0)