mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
12
Python/executor_cases.c.h
generated
12
Python/executor_cases.c.h
generated
|
@ -2240,8 +2240,10 @@
|
|||
_PyStackRef tup;
|
||||
oparg = CURRENT_OPARG();
|
||||
values = &stack_pointer[-oparg];
|
||||
PyObject *tup_o = _PyTuple_FromStackRefSteal(values, oparg);
|
||||
if (tup_o == NULL) JUMP_TO_ERROR();
|
||||
PyObject *tup_o = _PyTuple_FromStackRefStealOnSuccess(values, oparg);
|
||||
if (tup_o == NULL) {
|
||||
JUMP_TO_ERROR();
|
||||
}
|
||||
tup = PyStackRef_FromPyObjectSteal(tup_o);
|
||||
stack_pointer[-oparg] = tup;
|
||||
stack_pointer += 1 - oparg;
|
||||
|
@ -2254,8 +2256,10 @@
|
|||
_PyStackRef list;
|
||||
oparg = CURRENT_OPARG();
|
||||
values = &stack_pointer[-oparg];
|
||||
PyObject *list_o = _PyList_FromStackRefSteal(values, oparg);
|
||||
if (list_o == NULL) JUMP_TO_ERROR();
|
||||
PyObject *list_o = _PyList_FromStackRefStealOnSuccess(values, oparg);
|
||||
if (list_o == NULL) {
|
||||
JUMP_TO_ERROR();
|
||||
}
|
||||
list = PyStackRef_FromPyObjectSteal(list_o);
|
||||
stack_pointer[-oparg] = list;
|
||||
stack_pointer += 1 - oparg;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue