summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-22 21:15:44 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-22 21:15:44 (GMT)
commitb9009391868f739f4ddf09fa04061f6af05228b3 (patch)
tree984b506935ee9ce653cc7dd1268934e412639dac /Objects
parent559bb6a71399af3b1b2a0ba97230d2bcc649e993 (diff)
downloadcpython-b9009391868f739f4ddf09fa04061f6af05228b3.zip
cpython-b9009391868f739f4ddf09fa04061f6af05228b3.tar.gz
cpython-b9009391868f739f4ddf09fa04061f6af05228b3.tar.bz2
_PyFunction_FastCallDict() supports keyword args
Issue #27809: * Rename _PyFunction_FastCall() to _PyFunction_FastCallDict() * Rename _PyCFunction_FastCall() to _PyCFunction_FastCallDict() * _PyFunction_FastCallDict() now supports keyword arguments
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c11
-rw-r--r--Objects/methodobject.c6
2 files changed, 8 insertions, 9 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 2ce7f32..0e67693 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2255,7 +2255,8 @@ _PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs)
}
PyObject *
-_PyObject_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs)
+_PyObject_FastCallDict(PyObject *func, PyObject **args, int nargs,
+ PyObject *kwargs)
{
ternaryfunc call;
PyObject *result = NULL;
@@ -2268,19 +2269,17 @@ _PyObject_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwa
assert(func != NULL);
assert(nargs >= 0);
assert(nargs == 0 || args != NULL);
- /* issue #27128: support for keywords will come later:
- _PyFunction_FastCall() doesn't support keyword arguments yet */
- assert(kwargs == NULL);
+ assert(kwargs == NULL || PyDict_Check(kwargs));
if (Py_EnterRecursiveCall(" while calling a Python object")) {
return NULL;
}
if (PyFunction_Check(func)) {
- result = _PyFunction_FastCall(func, args, nargs, kwargs);
+ result = _PyFunction_FastCallDict(func, args, nargs, kwargs);
}
else if (PyCFunction_Check(func)) {
- result = _PyCFunction_FastCall(func, args, nargs, kwargs);
+ result = _PyCFunction_FastCallDict(func, args, nargs, kwargs);
}
else {
PyObject *tuple;
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index 0e26232..edb2fc0 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -146,8 +146,8 @@ PyCFunction_Call(PyObject *func, PyObject *args, PyObject *kwds)
}
PyObject *
-_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, int nargs,
- PyObject *kwargs)
+_PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, int nargs,
+ PyObject *kwargs)
{
PyCFunctionObject* func = (PyCFunctionObject*)func_obj;
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
@@ -155,7 +155,7 @@ _PyCFunction_FastCall(PyObject *func_obj, PyObject **args, int nargs,
PyObject *result;
int flags;
- /* _PyCFunction_FastCall() must not be called with an exception set,
+ /* _PyCFunction_FastCallDict() must not be called with an exception set,
because it may clear it (directly or indirectly) and so the
caller loses its exception */
assert(!PyErr_Occurred());