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
|
@ -1852,16 +1852,20 @@ dummy_func(
|
|||
}
|
||||
|
||||
inst(BUILD_TUPLE, (values[oparg] -- tup)) {
|
||||
PyObject *tup_o = _PyTuple_FromStackRefSteal(values, oparg);
|
||||
PyObject *tup_o = _PyTuple_FromStackRefStealOnSuccess(values, oparg);
|
||||
if (tup_o == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
INPUTS_DEAD();
|
||||
ERROR_IF(tup_o == NULL, error);
|
||||
tup = PyStackRef_FromPyObjectSteal(tup_o);
|
||||
}
|
||||
|
||||
inst(BUILD_LIST, (values[oparg] -- list)) {
|
||||
PyObject *list_o = _PyList_FromStackRefSteal(values, oparg);
|
||||
PyObject *list_o = _PyList_FromStackRefStealOnSuccess(values, oparg);
|
||||
if (list_o == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
INPUTS_DEAD();
|
||||
ERROR_IF(list_o == NULL, error);
|
||||
list = PyStackRef_FromPyObjectSteal(list_o);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue