gh-117139: Add _PyTuple_FromStackRefSteal and use it (#121244)

Avoids the extra conversion from stack refs to PyObjects.
This commit is contained in:
Sam Gross 2024-07-02 12:30:14 -04:00 committed by GitHub
parent 1ac273224a
commit 8e8d202f55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 28 additions and 33 deletions

View file

@ -1780,13 +1780,7 @@ dummy_func(
}
inst(BUILD_TUPLE, (values[oparg] -- tup)) {
STACKREFS_TO_PYOBJECTS(values, oparg, values_o);
if (CONVERSION_FAILED(values_o)) {
DECREF_INPUTS();
ERROR_IF(true, error);
}
PyObject *tup_o = _PyTuple_FromArraySteal(values_o, oparg);
STACKREFS_TO_PYOBJECTS_CLEANUP(values_o);
PyObject *tup_o = _PyTuple_FromStackRefSteal(values, oparg);
ERROR_IF(tup_o == NULL, error);
tup = PyStackRef_FromPyObjectSteal(tup_o);
}