diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-12-09 15:22:32 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-12-09 15:22:32 (GMT) |
commit | 5abaa2b139fb75a76933fb5437e09021fd080fae (patch) | |
tree | 6c58da8c7648f939bcb5b8e50755cf9013d8e00f /Objects | |
parent | 55ba38a48097e4b21b406cc617df1481727f5c25 (diff) | |
download | cpython-5abaa2b139fb75a76933fb5437e09021fd080fae.zip cpython-5abaa2b139fb75a76933fb5437e09021fd080fae.tar.gz cpython-5abaa2b139fb75a76933fb5437e09021fd080fae.tar.bz2 |
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.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 2 | ||||
-rw-r--r-- | Objects/descrobject.c | 2 |
2 files changed, 2 insertions, 2 deletions
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 @@ _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) */ diff --git a/Objects/descrobject.c b/Objects/descrobject.c index ee356b1..090c9cd 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -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; |