bpo-29548: no longer use PyEval_Call* functions (GH-14683)

This commit is contained in:
Jeroen Demeyer 2019-07-11 17:57:32 +02:00 committed by Inada Naoki
parent 9b5ce62cac
commit 1dbd084f1f
4 changed files with 14 additions and 6 deletions

View File

@ -208,7 +208,7 @@ call_with_frame(const char *funcname, int lineno, PyObject* func, PyObject* args
{
PyObject *res;
res = PyEval_CallObject(func, args);
res = PyObject_Call(func, args, NULL);
if (res == NULL) {
_PyTraceback_Add(funcname, __FILE__, lineno);
XML_StopParser(self->itself, XML_FALSE);

View File

@ -1667,8 +1667,7 @@ _PyErr_CheckSignals(void)
_Py_atomic_store_relaxed(&Handlers[i].tripped, 0);
if (arglist) {
result = PyEval_CallObject(Handlers[i].func,
arglist);
result = PyObject_Call(Handlers[i].func, arglist, NULL);
Py_DECREF(arglist);
}
if (!result) {

View File

@ -457,7 +457,16 @@ PyEval_CallObjectWithKeywords(PyObject *callable,
PyObject *
PyObject_CallObject(PyObject *callable, PyObject *args)
{
return PyEval_CallObjectWithKeywords(callable, args, NULL);
assert(!PyErr_Occurred());
if (args == NULL) {
return _PyObject_CallNoArg(callable);
}
if (!PyTuple_Check(args)) {
PyErr_SetString(PyExc_TypeError,
"argument list must be a tuple");
return NULL;
}
return PyObject_Call(callable, args, NULL);
}

View File

@ -416,7 +416,7 @@ _PyCodec_EncodeInternal(PyObject *object,
if (args == NULL)
goto onError;
result = PyEval_CallObject(encoder, args);
result = PyObject_Call(encoder, args, NULL);
if (result == NULL) {
wrap_codec_error("encoding", encoding);
goto onError;
@ -462,7 +462,7 @@ _PyCodec_DecodeInternal(PyObject *object,
if (args == NULL)
goto onError;
result = PyEval_CallObject(decoder,args);
result = PyObject_Call(decoder, args, NULL);
if (result == NULL) {
wrap_codec_error("decoding", encoding);
goto onError;