Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 56748e9

Browse files
author
Anselm Kruis
committed
Merge branch master into master-slp
2 parents 022e9d5 + 8a31c82 commit 56748e9

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

Include/abstract.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
264264
*/
265265

266266
PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
267-
PyObject *args, PyObject *kw);
267+
PyObject *args, PyObject *kwargs);
268268

269269
#ifndef Py_LIMITED_API
270270
PyAPI_FUNC(PyObject*) _PyStack_AsTuple(PyObject **stack,

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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,7 @@ _Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where)
21952195
}
21962196

21972197
PyObject *
2198-
PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
2198+
PyObject_Call(PyObject *func, PyObject *args, PyObject *kwargs)
21992199
{
22002200
STACKLESS_GETARG();
22012201
ternaryfunc call;
@@ -2205,6 +2205,8 @@ PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
22052205
because it may clear it (directly or indirectly) and so the
22062206
caller loses its exception */
22072207
assert(!PyErr_Occurred());
2208+
assert(PyTuple_Check(args));
2209+
assert(kwargs == NULL || PyDict_Check(kwargs));
22082210

22092211
call = func->ob_type->tp_call;
22102212
if (call == NULL) {
@@ -2224,7 +2226,8 @@ PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
22242226
if (Py_EnterRecursiveCall(" while calling a Python object"))
22252227
return NULL;
22262228

2227-
result = (STACKLESS_PROMOTE(func), (*call)(func, arg, kw) );
2229+
STACKLESS_PROMOTE(func);
2230+
result = (*call)(func, args, kwargs);
22282231
STACKLESS_ASSERT();
22292232

22302233
#ifdef STACKLESS

Python/ceval.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5062,7 +5062,7 @@ PyEval_MergeCompilerFlags(PyCompilerFlags *cf)
50625062
The arg must be a tuple or NULL. The kw must be a dict or NULL. */
50635063

50645064
PyObject *
5065-
PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)
5065+
PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs)
50665066
{
50675067
STACKLESS_GETARG();
50685068
PyObject *result;
@@ -5074,37 +5074,38 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)
50745074
assert(!PyErr_Occurred());
50755075
#endif
50765076

5077-
if (arg == NULL) {
5078-
if (kw == NULL) {
5077+
if (args == NULL) {
5078+
if (kwargs == NULL) {
50795079
STACKLESS_PROMOTE_ALL();
50805080
result = _PyObject_FastCall(func, NULL, 0, 0);
50815081
STACKLESS_ASSERT();
50825082
return result;
50835083
}
50845084

5085-
arg = PyTuple_New(0);
5086-
if (arg == NULL)
5085+
args = PyTuple_New(0);
5086+
if (args == NULL)
50875087
return NULL;
50885088
}
5089-
else if (!PyTuple_Check(arg)) {
5089+
else if (!PyTuple_Check(args)) {
50905090
PyErr_SetString(PyExc_TypeError,
50915091
"argument list must be a tuple");
50925092
return NULL;
50935093
}
5094-
else
5095-
Py_INCREF(arg);
5094+
else {
5095+
Py_INCREF(args);
5096+
}
50965097

5097-
if (kw != NULL && !PyDict_Check(kw)) {
5098+
if (kwargs != NULL && !PyDict_Check(kwargs)) {
50985099
PyErr_SetString(PyExc_TypeError,
50995100
"keyword list must be a dictionary");
5100-
Py_DECREF(arg);
5101+
Py_DECREF(args);
51015102
return NULL;
51025103
}
51035104

51045105
STACKLESS_PROMOTE_ALL();
5105-
result = PyObject_Call(func, arg, kw);
5106+
result = PyObject_Call(func, args, kwargs);
51065107
STACKLESS_ASSERT();
5107-
Py_DECREF(arg);
5108+
Py_DECREF(args);
51085109

51095110
return result;
51105111
}

0 commit comments

Comments
 (0)