mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
GH-96678: Fix undefined behavior in ceval.c (GH-96708)
(cherry picked from commit 50a70a083d
)
Co-authored-by: Mark Shannon <mark@hotpy.org>
This commit is contained in:
parent
c563b89261
commit
7033dc8adc
2 changed files with 8 additions and 1 deletions
|
@ -6166,7 +6166,13 @@ initialize_locals(PyThreadState *tstate, PyFunctionObject *func,
|
|||
/* Pack other positional arguments into the *args argument */
|
||||
if (co->co_flags & CO_VARARGS) {
|
||||
PyObject *u = NULL;
|
||||
u = _PyTuple_FromArraySteal(args + n, argcount - n);
|
||||
if (argcount == n) {
|
||||
u = Py_NewRef(&_Py_SINGLETON(tuple_empty));
|
||||
}
|
||||
else {
|
||||
assert(args != NULL);
|
||||
u = _PyTuple_FromArraySteal(args + n, argcount - n);
|
||||
}
|
||||
if (u == NULL) {
|
||||
goto fail_post_positional;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue