cpython: f1ad6f64a11e (original) (raw)
Mercurial > cpython
changeset 102763:f1ad6f64a11e
Fix PyObject_Call() parameter names Issue #27128: arg=>args, kw=>kwargs. Same change for PyEval_CallObjectWithKeywords(). [#27128]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Fri, 19 Aug 2016 17:12:23 +0200 |
parents | 5cf9524f2923 |
children | 2da6dc1c30d8 |
files | Include/abstract.h Include/ceval.h Objects/abstract.c Python/ceval.c |
diffstat | 4 files changed, 20 insertions(+), 17 deletions(-)[+] [-] Include/abstract.h 2 Include/ceval.h 2 Objects/abstract.c 6 Python/ceval.c 27 |
line wrap: on
line diff
--- a/Include/abstract.h +++ b/Include/abstract.h @@ -264,7 +264,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */ PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
PyObject *args, PyObject *kw);[](#l1.7)
PyObject *args, PyObject *kwargs);[](#l1.8)
#ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyStack_AsTuple(PyObject **stack,
--- a/Include/ceval.h +++ b/Include/ceval.h @@ -8,7 +8,7 @@ extern "C" { /* Interface to random parts in ceval.c */ PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
/* Inline this */ #define PyEval_CallObject(func,arg) [](#l2.11)
--- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2194,7 +2194,7 @@ PyObject* } PyObject * -PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) +PyObject_Call(PyObject *func, PyObject *args, PyObject *kwargs) { ternaryfunc call; PyObject *result; @@ -2203,6 +2203,8 @@ PyObject_Call(PyObject *func, PyObject * because it may clear it (directly or indirectly) and so the caller loses its exception */ assert(!PyErr_Occurred());
call = func->ob_type->tp_call; if (call == NULL) { @@ -2214,7 +2216,7 @@ PyObject_Call(PyObject *func, PyObject * if (Py_EnterRecursiveCall(" while calling a Python object")) return NULL;
--- a/Python/ceval.c +++ b/Python/ceval.c @@ -4580,7 +4580,7 @@ PyEval_MergeCompilerFlags(PyCompilerFlag The arg must be a tuple or NULL. The kw must be a dict or NULL. */ PyObject * -PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw) +PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs) { PyObject *result; @@ -4591,32 +4591,33 @@ PyEval_CallObjectWithKeywords(PyObject * assert(!PyErr_Occurred()); #endif
- if (args == NULL) {
if (kwargs == NULL) {[](#l4.19) return _PyObject_FastCall(func, NULL, 0, 0);[](#l4.20) }[](#l4.21)
arg = PyTuple_New(0);[](#l4.23)
if (arg == NULL)[](#l4.24)
- else if (!PyTuple_Check(args)) { PyErr_SetString(PyExc_TypeError, "argument list must be a tuple"); return NULL; }
- if (kwargs != NULL && !PyDict_Check(kwargs)) { PyErr_SetString(PyExc_TypeError, "keyword list must be a dictionary");
Py_DECREF(arg);[](#l4.46)