gh-117139: Replace _PyList_FromArraySteal with stack ref variant (#122830)

This replaces `_PyList_FromArraySteal` with `_PyList_FromStackRefSteal`.
It's functionally equivalent, but takes a `_PyStackRef` array instead of
an array of `PyObject` pointers.

Co-authored-by: Ken Jin <kenjin@python.org>
This commit is contained in:
Sam Gross 2024-08-12 14:49:49 -04:00 committed by GitHub
parent 736fe4d23e
commit ab094d1b2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 34 deletions

View file

@ -631,19 +631,7 @@
_PyStackRef *values;
_PyStackRef list;
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;
assert(WITHIN_STACK_BOUNDS());
goto error;
}
}
PyObject *list_o = _PyList_FromArraySteal(values_o, oparg);
STACKREFS_TO_PYOBJECTS_CLEANUP(values_o);
PyObject *list_o = _PyList_FromStackRefSteal(values, oparg);
if (list_o == NULL) {
stack_pointer += -oparg;
assert(WITHIN_STACK_BOUNDS());