mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
GH-128682: Change a couple of functions to only steal references on success. (GH-129132)
Change PyTuple_FromStackRefSteal and PyList_FromStackRefSteal to only steal on success to avoid escaping
This commit is contained in:
parent
a65f802692
commit
470a0a68eb
11 changed files with 34 additions and 32 deletions
|
@ -1527,7 +1527,12 @@ initialize_locals(PyThreadState *tstate, PyFunctionObject *func,
|
|||
u = (PyObject *)&_Py_SINGLETON(tuple_empty);
|
||||
}
|
||||
else {
|
||||
u = _PyTuple_FromStackRefSteal(args + n, argcount - n);
|
||||
u = _PyTuple_FromStackRefStealOnSuccess(args + n, argcount - n);
|
||||
if (u == NULL) {
|
||||
for (Py_ssize_t i = n; i < argcount; i++) {
|
||||
PyStackRef_CLOSE(args[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (u == NULL) {
|
||||
goto fail_post_positional;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue