mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
Fix PyObject_Call() parameter names
Issue #27128: arg=>args, kw=>kwargs. Same change for PyEval_CallObjectWithKeywords().
This commit is contained in:
parent
0d1a799343
commit
8a31c82093
4 changed files with 19 additions and 16 deletions
|
@ -4580,7 +4580,7 @@ PyEval_MergeCompilerFlags(PyCompilerFlags *cf)
|
|||
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 *func, PyObject *arg, PyObject *kw)
|
|||
assert(!PyErr_Occurred());
|
||||
#endif
|
||||
|
||||
if (arg == NULL) {
|
||||
if (kw == NULL) {
|
||||
if (args == NULL) {
|
||||
if (kwargs == NULL) {
|
||||
return _PyObject_FastCall(func, NULL, 0, 0);
|
||||
}
|
||||
|
||||
arg = PyTuple_New(0);
|
||||
if (arg == NULL)
|
||||
args = PyTuple_New(0);
|
||||
if (args == NULL)
|
||||
return NULL;
|
||||
}
|
||||
else if (!PyTuple_Check(arg)) {
|
||||
else if (!PyTuple_Check(args)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"argument list must be a tuple");
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
Py_INCREF(arg);
|
||||
else {
|
||||
Py_INCREF(args);
|
||||
}
|
||||
|
||||
if (kw != NULL && !PyDict_Check(kw)) {
|
||||
if (kwargs != NULL && !PyDict_Check(kwargs)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"keyword list must be a dictionary");
|
||||
Py_DECREF(arg);
|
||||
Py_DECREF(args);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result = PyObject_Call(func, arg, kw);
|
||||
Py_DECREF(arg);
|
||||
result = PyObject_Call(func, args, kwargs);
|
||||
Py_DECREF(args);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue