mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-37483: add _PyObject_CallOneArg() function (#14558)
This commit is contained in:
parent
9d40554e0d
commit
196a530e00
44 changed files with 128 additions and 146 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue