diff options
| author | Jeroen Demeyer <J.Demeyer@UGent.be> | 2019-07-11 17:57:32 +0200 |
|---|---|---|
| committer | Inada Naoki <songofacandy@gmail.com> | 2019-07-12 00:57:32 +0900 |
| commit | 1dbd084f1f68d7293718b663df675cfbd0c65712 (patch) | |
| tree | 134dd51d1364168e6f55f6dae348213dbdd136d7 | |
| parent | 9b5ce62cac27fec9dea473865d79c2c654312957 (diff) | |
| download | cpython-git-1dbd084f1f68d7293718b663df675cfbd0c65712.tar.gz | |
bpo-29548: no longer use PyEval_Call* functions (GH-14683)
| -rw-r--r-- | Modules/pyexpat.c | 2 | ||||
| -rw-r--r-- | Modules/signalmodule.c | 3 | ||||
| -rw-r--r-- | Objects/call.c | 11 | ||||
| -rw-r--r-- | Python/codecs.c | 4 |
4 files changed, 14 insertions, 6 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 3d193e717c..b0096e6647 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -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); diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 7698984ff3..95569b931d 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -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) { diff --git a/Objects/call.c b/Objects/call.c index df90595d6c..7d917891bc 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -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); } diff --git a/Python/codecs.c b/Python/codecs.c index 75b60ec6bd..4f38b33e0b 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -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; |
