mirror of
https://github.com/python/cpython.git
synced 2025-09-21 16:10:33 +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
|
@ -0,0 +1 @@
|
||||||
|
Fix case of undefined behavior in ceval.c
|
|
@ -6166,7 +6166,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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue