bpo-37483: add _PyObject_CallOneArg() function (#14558)

This commit is contained in:
Jeroen Demeyer 2019-07-04 12:31:34 +02:00 committed by Inada Naoki
parent 9d40554e0d
commit 196a530e00
44 changed files with 128 additions and 146 deletions

View file

@ -590,7 +590,7 @@ call_show_warning(PyObject *category, PyObject *text, PyObject *message,
if (msg == NULL)
goto error;
res = PyObject_CallFunctionObjArgs(show_fn, msg, NULL);
res = _PyObject_CallOneArg(show_fn, msg);
Py_DECREF(show_fn);
Py_DECREF(msg);
@ -651,7 +651,7 @@ warn_explicit(PyObject *category, PyObject *message,
}
else {
text = message;
message = PyObject_CallFunctionObjArgs(category, message, NULL);
message = _PyObject_CallOneArg(category, message);
if (message == NULL)
goto cleanup;
}
@ -996,7 +996,7 @@ get_source_line(PyObject *module_globals, int lineno)
return NULL;
}
/* Call get_source() to get the source code. */
source = PyObject_CallFunctionObjArgs(get_source, module_name, NULL);
source = _PyObject_CallOneArg(get_source, module_name);
Py_DECREF(get_source);
Py_DECREF(module_name);
if (!source) {
@ -1283,7 +1283,7 @@ _PyErr_WarnUnawaitedCoroutine(PyObject *coro)
int warned = 0;
PyObject *fn = get_warnings_attr(&PyId__warn_unawaited_coroutine, 1);
if (fn) {
PyObject *res = PyObject_CallFunctionObjArgs(fn, coro, NULL);
PyObject *res = _PyObject_CallOneArg(fn, coro);
Py_DECREF(fn);
if (res || PyErr_ExceptionMatches(PyExc_RuntimeWarning)) {
warned = 1;