mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
GH-96678: Fix undefined behavior in ceval.c (#96708)
This commit is contained in:
parent
72b29b2611
commit
50a70a083d
2 changed files with 8 additions and 1 deletions
|
@ -0,0 +1 @@
|
||||||
|
Fix case of undefined behavior in ceval.c
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue