Skip to content

Commit 1dbd084

Browse files
jdemeyermethane
authored andcommitted
bpo-29548: no longer use PyEval_Call* functions (GH-14683)
1 parent 9b5ce62 commit 1dbd084

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

Modules/pyexpat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ call_with_frame(const char *funcname, int lineno, PyObject* func, PyObject* args
208208
{
209209
PyObject *res;
210210

211-
res = PyEval_CallObject(func, args);
211+
res = PyObject_Call(func, args, NULL);
212212
if (res == NULL) {
213213
_PyTraceback_Add(funcname, __FILE__, lineno);
214214
XML_StopParser(self->itself, XML_FALSE);

Modules/signalmodule.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,8 +1667,7 @@ _PyErr_CheckSignals(void)
16671667
_Py_atomic_store_relaxed(&Handlers[i].tripped, 0);
16681668

16691669
if (arglist) {
1670-
result = PyEval_CallObject(Handlers[i].func,
1671-
arglist);
1670+
result = PyObject_Call(Handlers[i].func, arglist, NULL);
16721671
Py_DECREF(arglist);
16731672
}
16741673
if (!result) {

Objects/call.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,16 @@ PyEval_CallObjectWithKeywords(PyObject *callable,
457457
PyObject *
458458
PyObject_CallObject(PyObject *callable, PyObject *args)
459459
{
460-
return PyEval_CallObjectWithKeywords(callable, args, NULL);
460+
assert(!PyErr_Occurred());
461+
if (args == NULL) {
462+
return _PyObject_CallNoArg(callable);
463+
}
464+
if (!PyTuple_Check(args)) {
465+
PyErr_SetString(PyExc_TypeError,
466+
"argument list must be a tuple");
467+
return NULL;
468+
}
469+
return PyObject_Call(callable, args, NULL);
461470
}
462471

463472

Python/codecs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ _PyCodec_EncodeInternal(PyObject *object,
416416
if (args == NULL)
417417
goto onError;
418418

419-
result = PyEval_CallObject(encoder, args);
419+
result = PyObject_Call(encoder, args, NULL);
420420
if (result == NULL) {
421421
wrap_codec_error("encoding", encoding);
422422
goto onError;
@@ -462,7 +462,7 @@ _PyCodec_DecodeInternal(PyObject *object,
462462
if (args == NULL)
463463
goto onError;
464464

465-
result = PyEval_CallObject(decoder,args);
465+
result = PyObject_Call(decoder, args, NULL);
466466
if (result == NULL) {
467467
wrap_codec_error("decoding", encoding);
468468
goto onError;

0 commit comments

Comments
 (0)