diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-09-09 21:07:44 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-09-09 21:07:44 (GMT) |
commit | ae8b69c410b83d92c6c35bbe342c3c2e92be6aa1 (patch) | |
tree | fa8de02f97c6831a0350d18c93e9aba25956187d /Objects/abstract.c | |
parent | 502893896a6b2b312654e5b5d75398c759d715e1 (diff) | |
download | cpython-ae8b69c410b83d92c6c35bbe342c3c2e92be6aa1.zip cpython-ae8b69c410b83d92c6c35bbe342c3c2e92be6aa1.tar.gz cpython-ae8b69c410b83d92c6c35bbe342c3c2e92be6aa1.tar.bz2 |
Issue #27810: Add _PyCFunction_FastCallKeywords()
Use _PyCFunction_FastCallKeywords() in ceval.c: it allows to remove a lot of
code from ceval.c which was only used to call C functions.
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 508fd82..9de6b83 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2366,7 +2366,7 @@ _PyObject_Call_Prepend(PyObject *func, return result; } -static PyObject * +PyObject * _PyStack_AsDict(PyObject **values, Py_ssize_t nkwargs, PyObject *kwnames, PyObject *func) { @@ -2415,10 +2415,13 @@ _PyObject_FastCallKeywords(PyObject *func, PyObject **stack, Py_ssize_t nargs, assert((nargs == 0 && nkwargs == 0) || stack != NULL); if (PyFunction_Check(func)) { - /* Fast-path: avoid temporary tuple or dict */ return _PyFunction_FastCallKeywords(func, stack, nargs, kwnames); } + if (PyCFunction_Check(func)) { + return _PyCFunction_FastCallKeywords(func, stack, nargs, kwnames); + } + if (nkwargs > 0) { kwdict = _PyStack_AsDict(stack + nargs, nkwargs, kwnames, func); if (kwdict == NULL) { |