Skip to content

Commit abb47de

Browse files
committed
Fix NULL check in Py_BuildValue
1 parent 81a04b3 commit abb47de

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,17 +383,17 @@ MUST_INLINE static PyObject* _PyTruffle_BuildValue(const char* format, va_list v
383383
}
384384
}
385385

386-
if (void_arg == NULL) {
386+
if (converter != NULL) {
387+
PyList_Append(list, converter(void_arg));
388+
converter = NULL;
389+
format_idx++;
390+
} else if (void_arg == NULL) {
387391
if (!PyErr_Occurred()) {
388392
/* If a NULL was passed because a call that should have constructed a value failed, that's OK,
389393
* and we pass the error on; but if no error occurred it's not clear that the caller knew what she was doing. */
390394
PyErr_SetString(PyExc_SystemError, "NULL object passed to Py_BuildValue");
391395
}
392396
return NULL;
393-
} else if (converter != NULL) {
394-
PyList_Append(list, converter(void_arg));
395-
converter = NULL;
396-
format_idx++;
397397
} else {
398398
if (c != 'N') {
399399
Py_INCREF((PyObject*)void_arg);

0 commit comments

Comments
 (0)