mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
gh-117139: Add _PyTuple_FromStackRefSteal and use it (#121244)
Avoids the extra conversion from stack refs to PyObjects.
This commit is contained in:
parent
1ac273224a
commit
8e8d202f55
8 changed files with 28 additions and 33 deletions
10
Python/generated_cases.c.h
generated
10
Python/generated_cases.c.h
generated
|
|
@ -769,15 +769,7 @@
|
|||
_PyStackRef *values;
|
||||
_PyStackRef tup;
|
||||
values = &stack_pointer[-oparg];
|
||||
STACKREFS_TO_PYOBJECTS(values, oparg, values_o);
|
||||
if (CONVERSION_FAILED(values_o)) {
|
||||
for (int _i = oparg; --_i >= 0;) {
|
||||
PyStackRef_CLOSE(values[_i]);
|
||||
}
|
||||
if (true) { stack_pointer += -oparg; goto error; }
|
||||
}
|
||||
PyObject *tup_o = _PyTuple_FromArraySteal(values_o, oparg);
|
||||
STACKREFS_TO_PYOBJECTS_CLEANUP(values_o);
|
||||
PyObject *tup_o = _PyTuple_FromStackRefSteal(values, oparg);
|
||||
if (tup_o == NULL) { stack_pointer += -oparg; goto error; }
|
||||
tup = PyStackRef_FromPyObjectSteal(tup_o);
|
||||
stack_pointer[-oparg] = tup;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue