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.
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 2c5057d..d3b9ec0 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2549,7 +2549,7 @@
}
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) */