mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
bpo-45256: Avoid C calls for most Python to Python calls. (GH-28937)
* Avoid making C calls for most calls to Python functions. * Change initialize_locals(steal=true) and _PyTuple_FromArraySteal to consume the argument references regardless of whether they succeed or fail.
This commit is contained in:
parent
fd03917786
commit
70945d57e7
3 changed files with 128 additions and 180 deletions
|
|
@ -490,9 +490,11 @@ _PyTuple_FromArraySteal(PyObject *const *src, Py_ssize_t n)
|
|||
if (n == 0) {
|
||||
return tuple_get_empty();
|
||||
}
|
||||
|
||||
PyTupleObject *tuple = tuple_alloc(n);
|
||||
if (tuple == NULL) {
|
||||
for (Py_ssize_t i = 0; i < n; i++) {
|
||||
Py_DECREF(src[i]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
PyObject **dst = tuple->ob_item;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue