diff options
author | Jeroen Demeyer <J.Demeyer@UGent.be> | 2019-07-04 10:31:34 (GMT) |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2019-07-04 10:31:34 (GMT) |
commit | 196a530e00d88a138973bf9182e013937e293f97 (patch) | |
tree | 35443abb5aa148b459f68ae43a18cdbb0627ba76 /Modules/cjkcodecs | |
parent | 9d40554e0da09a44a8547f3f3a2b9dedfeaf7928 (diff) | |
download | cpython-196a530e00d88a138973bf9182e013937e293f97.zip cpython-196a530e00d88a138973bf9182e013937e293f97.tar.gz cpython-196a530e00d88a138973bf9182e013937e293f97.tar.bz2 |
bpo-37483: add _PyObject_CallOneArg() function (#14558)
Diffstat (limited to 'Modules/cjkcodecs')
-rw-r--r-- | Modules/cjkcodecs/cjkcodecs.h | 2 | ||||
-rw-r--r-- | Modules/cjkcodecs/multibytecodec.c | 14 |
2 files changed, 3 insertions, 13 deletions
diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h index b67f348..7ed8365 100644 --- a/Modules/cjkcodecs/cjkcodecs.h +++ b/Modules/cjkcodecs/cjkcodecs.h @@ -291,7 +291,7 @@ getcodec(PyObject *self, PyObject *encoding) if (codecobj == NULL) return NULL; - r = PyObject_CallFunctionObjArgs(cofunc, codecobj, NULL); + r = _PyObject_CallOneArg(cofunc, codecobj); Py_DECREF(codecobj); return r; diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index c01a0e5..052ed88 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -81,7 +81,7 @@ internal_error_callback(const char *errors) static PyObject * call_error_callback(PyObject *errors, PyObject *exc) { - PyObject *args, *cb, *r; + PyObject *cb, *r; const char *str; assert(PyUnicode_Check(errors)); @@ -92,17 +92,7 @@ call_error_callback(PyObject *errors, PyObject *exc) if (cb == NULL) return NULL; - args = PyTuple_New(1); - if (args == NULL) { - Py_DECREF(cb); - return NULL; - } - - PyTuple_SET_ITEM(args, 0, exc); - Py_INCREF(exc); - - r = PyObject_CallObject(cb, args); - Py_DECREF(args); + r = _PyObject_CallOneArg(cb, exc); Py_DECREF(cb); return r; } |