Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f745bf

Browse files
committed
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.
1 parent 9be7e7b commit 3f745bf

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Python/ceval.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4592,6 +4592,10 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)
45924592
#endif
45934593

45944594
if (arg == NULL) {
4595+
if (kw == NULL) {
4596+
return _PyObject_FastCall(func, NULL, 0, 0);
4597+
}
4598+
45954599
arg = PyTuple_New(0);
45964600
if (arg == NULL)
45974601
return NULL;

0 commit comments

Comments
 (0)