Fix PyObject_Call() parameter names · pythoncapi/cpython@8a31c82 · GitHub
Skip to content

Commit 8a31c82

Browse files
committed
Fix PyObject_Call() parameter names
Issue python#27128: arg=>args, kw=>kwargs. Same change for PyEval_CallObjectWithKeywords().
1 parent 0d1a799 commit 8a31c82

4 files changed

Lines changed: 19 additions & 16 deletions

File tree

Include/abstract.h

Lines changed: 1 addition & 1 deletion

Include/ceval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern "C" {
88
/* Interface to random parts in ceval.c */
99

1010
PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
11-
PyObject *, PyObject *, PyObject *);
11+
PyObject *func, PyObject *args, PyObject *kwargs);
1212

1313
/* Inline this */
1414
#define PyEval_CallObject(func,arg) \

Objects/abstract.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,7 +2194,7 @@ _Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where)
21942194
}
21952195

21962196
PyObject *
2197-
PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
2197+
PyObject_Call(PyObject *func, PyObject *args, PyObject *kwargs)
21982198
{
21992199
ternaryfunc call;
22002200
PyObject *result;
@@ -2203,6 +2203,8 @@ PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
22032203
because it may clear it (directly or indirectly) and so the
22042204
caller loses its exception */
22052205
assert(!PyErr_Occurred());
2206+
assert(PyTuple_Check(args));
2207+
assert(kwargs == NULL || PyDict_Check(kwargs));
22062208

22072209
call = func->ob_type->tp_call;
22082210
if (call == NULL) {
@@ -2214,7 +2216,7 @@ PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
22142216
if (Py_EnterRecursiveCall(" while calling a Python object"))
22152217
return NULL;
22162218

2217-
result = (*call)(func, arg, kw);
2219+
result = (*call)(func, args, kwargs);
22182220

22192221
Py_LeaveRecursiveCall();
22202222

Python/ceval.c

Lines changed: 13 additions & 12 deletions

0 commit comments

Comments
 (0)