mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Use PyObject_CallFunctionObjArgs()
Issue #28915: Replace PyObject_CallFunction() with PyObject_CallFunctionObjArgs() when the format string was only made of "O" formats, PyObject* arguments. PyObject_CallFunctionObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string.
This commit is contained in:
parent
55ba38a480
commit
5abaa2b139
3 changed files with 16 additions and 10 deletions
|
@ -2549,7 +2549,7 @@ _PyObject_CallFunctionVa(PyObject *callable, const char *format,
|
|||
}
|
||||
|
||||
if (nargs == 1 && PyTuple_Check(stack[0])) {
|
||||
/* Special cases:
|
||||
/* Special cases for backward compatibility:
|
||||
- PyObject_CallFunction(func, "O", tuple) calls func(*tuple)
|
||||
- PyObject_CallFunction(func, "(OOO)", arg1, arg2, arg3) calls
|
||||
func(*(arg1, arg2, arg3)): func(arg1, arg2, arg3) */
|
||||
|
|
|
@ -1454,7 +1454,7 @@ property_copy(PyObject *old, PyObject *get, PyObject *set, PyObject *del)
|
|||
doc = pold->prop_doc ? pold->prop_doc : Py_None;
|
||||
}
|
||||
|
||||
new = PyObject_CallFunction(type, "OOOO", get, set, del, doc);
|
||||
new = PyObject_CallFunctionObjArgs(type, get, set, del, doc, NULL);
|
||||
Py_DECREF(type);
|
||||
if (new == NULL)
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue