summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-19 14:42:42 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-19 14:42:42 (GMT)
commit3f745bf1d90a75a0e3df5ba4d59b3ffbb71e3ebc (patch)
treefc9fc483d46213f1a9c91a7d0b5d6150112c78d7 /Python
parent9be7e7b52fa4b48012e956167a344df691195a04 (diff)
downloadcpython-3f745bf1d90a75a0e3df5ba4d59b3ffbb71e3ebc.zip
cpython-3f745bf1d90a75a0e3df5ba4d59b3ffbb71e3ebc.tar.gz
cpython-3f745bf1d90a75a0e3df5ba4d59b3ffbb71e3ebc.tar.bz2
PyEval_CallObjectWithKeywords() uses fast call
Issue #27128: Modify PyEval_CallObjectWithKeywords() to use _PyObject_FastCall() when args==NULL and kw==NULL. It avoids the creation of a temporary empty tuple for positional arguments.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index b9b21d1..75eaa81 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4592,6 +4592,10 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)
#endif
if (arg == NULL) {
+ if (kw == NULL) {
+ return _PyObject_FastCall(func, NULL, 0, 0);
+ }
+
arg = PyTuple_New(0);
if (arg == NULL)
return NULL;