mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
bpo-37483: add _PyObject_CallOneArg() function (#14558)
This commit is contained in:
parent
9d40554e0d
commit
196a530e00
44 changed files with 128 additions and 146 deletions
|
@ -29,7 +29,6 @@ update_bases(PyObject *bases, PyObject *const *args, Py_ssize_t nargs)
|
|||
{
|
||||
Py_ssize_t i, j;
|
||||
PyObject *base, *meth, *new_base, *result, *new_bases = NULL;
|
||||
PyObject *stack[1] = {bases};
|
||||
assert(PyTuple_Check(bases));
|
||||
|
||||
for (i = 0; i < nargs; i++) {
|
||||
|
@ -55,7 +54,7 @@ update_bases(PyObject *bases, PyObject *const *args, Py_ssize_t nargs)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
new_base = _PyObject_FastCall(meth, stack, 1);
|
||||
new_base = _PyObject_CallOneArg(meth, bases);
|
||||
Py_DECREF(meth);
|
||||
if (!new_base) {
|
||||
goto error;
|
||||
|
@ -574,7 +573,7 @@ filter_next(filterobject *lz)
|
|||
ok = PyObject_IsTrue(item);
|
||||
} else {
|
||||
PyObject *good;
|
||||
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
|
||||
good = _PyObject_CallOneArg(lz->func, item);
|
||||
if (good == NULL) {
|
||||
Py_DECREF(item);
|
||||
return NULL;
|
||||
|
@ -1625,7 +1624,7 @@ min_max(PyObject *args, PyObject *kwds, int op)
|
|||
while (( item = PyIter_Next(it) )) {
|
||||
/* get the value from the key function */
|
||||
if (keyfunc != NULL) {
|
||||
val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL);
|
||||
val = _PyObject_CallOneArg(keyfunc, item);
|
||||
if (val == NULL)
|
||||
goto Fail_it_item;
|
||||
}
|
||||
|
@ -2178,7 +2177,7 @@ builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits)
|
|||
if (ndigits == NULL || ndigits == Py_None)
|
||||
result = _PyObject_CallNoArg(round);
|
||||
else
|
||||
result = PyObject_CallFunctionObjArgs(round, ndigits, NULL);
|
||||
result = _PyObject_CallOneArg(round, ndigits);
|
||||
Py_DECREF(round);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue