Skip to content
Snippets Groups Projects
Unverified Commit 50a70a08 authored by Mark Shannon's avatar Mark Shannon Committed by GitHub
Browse files

GH-96678: Fix undefined behavior in ceval.c (#96708)

parent 72b29b26
No related branches found
No related tags found
No related merge requests found
Fix case of undefined behavior in ceval.c
...@@ -5532,7 +5532,13 @@ initialize_locals(PyThreadState *tstate, PyFunctionObject *func, ...@@ -5532,7 +5532,13 @@ initialize_locals(PyThreadState *tstate, PyFunctionObject *func,
/* Pack other positional arguments into the *args argument */ /* Pack other positional arguments into the *args argument */
if (co->co_flags & CO_VARARGS) { if (co->co_flags & CO_VARARGS) {
PyObject *u = NULL; PyObject *u = NULL;
if (argcount == n) {
u = Py_NewRef(&_Py_SINGLETON(tuple_empty));
}
else {
assert(args != NULL);
u = _PyTuple_FromArraySteal(args + n, argcount - n); u = _PyTuple_FromArraySteal(args + n, argcount - n);
}
if (u == NULL) { if (u == NULL) {
goto fail_post_positional; goto fail_post_positional;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment