}
a = args[0];
__clinic_args = PyTuple_New(nargs - 1);
+ if (!__clinic_args) {
+ goto exit;
+ }
for (Py_ssize_t i = 0; i < nargs - 1; ++i) {
PyTuple_SET_ITEM(__clinic_args, i, Py_NewRef(args[1 + i]));
}
static PyObject *
test_vararg_and_posonly_impl(PyObject *module, PyObject *a, PyObject *args)
-/*[clinic end generated code: output=081a953b8cbe7617 input=08dc2bf7afbf1613]*/
+/*[clinic end generated code: output=79b75dc07decc8d6 input=08dc2bf7afbf1613]*/
/*[clinic input]
test_vararg
--- /dev/null
+Add missing ``NULL`` check for possible allocation failure in ``*args`` parsing in Argument Clinic.
}
a = args[0];
__clinic_args = PyTuple_New(nargs - 1);
+ if (!__clinic_args) {
+ goto exit;
+ }
for (Py_ssize_t i = 0; i < nargs - 1; ++i) {
PyTuple_SET_ITEM(__clinic_args, i, Py_NewRef(args[1 + i]));
}
goto exit;
}
__clinic_args = PyTuple_New(nargs - 0);
+ if (!__clinic_args) {
+ goto exit;
+ }
for (Py_ssize_t i = 0; i < nargs - 0; ++i) {
PyTuple_SET_ITEM(__clinic_args, i, Py_NewRef(args[0 + i]));
}
exit:
return return_value;
}
-/*[clinic end generated code: output=fe398ac790310bc4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6b719efc1b8bd2c8 input=a9049054013a1b77]*/
if not new_or_init:
parser_code.append(normalize_snippet("""
%s = PyTuple_New(%s);
+ if (!%s) {{
+ goto exit;
+ }}
for (Py_ssize_t i = 0; i < %s; ++i) {{
PyTuple_SET_ITEM(%s, i, Py_NewRef(args[%d + i]));
}}
""" % (
p.converter.parser_name,
left_args,
+ p.converter.parser_name,
left_args,
p.converter.parser_name,
max_pos