bpo-39245: Switch to public API for Vectorcall (GH-18460)

The bulk of this patch was generated automatically with:

    for name in \
        PyObject_Vectorcall \
        Py_TPFLAGS_HAVE_VECTORCALL \
        PyObject_VectorcallMethod \
        PyVectorcall_Function \
        PyObject_CallOneArg \
        PyObject_CallMethodNoArgs \
        PyObject_CallMethodOneArg \
    ;
    do
        echo $name
        git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g"
    done

    old=_PyObject_FastCallDict
    new=PyObject_VectorcallDict
    git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g"

and then cleaned up:

- Revert changes to in docs & news
- Revert changes to backcompat defines in headers
- Nudge misaligned comments
This commit is contained in:
Petr Viktorin 2020-02-11 17:46:57 +01:00 committed by GitHub
parent f3e7ea5b8c
commit ffd9753a94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 194 additions and 194 deletions

View File

@ -67,7 +67,7 @@ PyVectorcall_Function(PyObject *callable)
{ {
assert(callable != NULL); assert(callable != NULL);
PyTypeObject *tp = Py_TYPE(callable); PyTypeObject *tp = Py_TYPE(callable);
if (!PyType_HasFeature(tp, _Py_TPFLAGS_HAVE_VECTORCALL)) { if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
return NULL; return NULL;
} }
assert(PyCallable_Check(callable)); assert(PyCallable_Check(callable));
@ -178,7 +178,7 @@ PyAPI_FUNC(PyObject *) PyObject_VectorcallMethod(
static inline PyObject * static inline PyObject *
PyObject_CallMethodNoArgs(PyObject *self, PyObject *name) PyObject_CallMethodNoArgs(PyObject *self, PyObject *name)
{ {
return _PyObject_VectorcallMethod(name, &self, return PyObject_VectorcallMethod(name, &self,
1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
} }
@ -187,7 +187,7 @@ PyObject_CallMethodOneArg(PyObject *self, PyObject *name, PyObject *arg)
{ {
assert(arg != NULL); assert(arg != NULL);
PyObject *args[2] = {self, arg}; PyObject *args[2] = {self, arg};
return _PyObject_VectorcallMethod(name, args, return PyObject_VectorcallMethod(name, args,
2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
} }

View File

@ -468,7 +468,7 @@ class FastCallTests(unittest.TestCase):
self.check_result(result, expected) self.check_result(result, expected)
def test_vectorcall_dict(self): def test_vectorcall_dict(self):
# Test _PyObject_FastCallDict() # Test PyObject_VectorcallDict()
for func, args, expected in self.CALLS_POSARGS: for func, args, expected in self.CALLS_POSARGS:
with self.subTest(func=func, args=args): with self.subTest(func=func, args=args):
@ -487,7 +487,7 @@ class FastCallTests(unittest.TestCase):
self.check_result(result, expected) self.check_result(result, expected)
def test_vectorcall(self): def test_vectorcall(self):
# Test _PyObject_Vectorcall() # Test PyObject_Vectorcall()
for func, args, expected in self.CALLS_POSARGS: for func, args, expected in self.CALLS_POSARGS:
with self.subTest(func=func, args=args): with self.subTest(func=func, args=args):
@ -594,7 +594,7 @@ class TestPEP590(unittest.TestCase):
# 1. vectorcall using PyVectorcall_Call() # 1. vectorcall using PyVectorcall_Call()
# (only for objects that support vectorcall directly) # (only for objects that support vectorcall directly)
# 2. normal call # 2. normal call
# 3. vectorcall using _PyObject_Vectorcall() # 3. vectorcall using PyObject_Vectorcall()
# 4. call as bound method # 4. call as bound method
# 5. call using functools.partial # 5. call using functools.partial

View File

@ -142,7 +142,7 @@ _is_coroutine(PyObject *coro)
Do this check after 'future_init()'; in case we need to raise Do this check after 'future_init()'; in case we need to raise
an error, __del__ needs a properly initialized object. an error, __del__ needs a properly initialized object.
*/ */
PyObject *res = _PyObject_CallOneArg(asyncio_iscoroutine_func, coro); PyObject *res = PyObject_CallOneArg(asyncio_iscoroutine_func, coro);
if (res == NULL) { if (res == NULL) {
return -1; return -1;
} }
@ -367,7 +367,7 @@ call_soon(PyObject *loop, PyObject *func, PyObject *arg, PyObject *ctx)
} }
stack[nargs] = (PyObject *)ctx; stack[nargs] = (PyObject *)ctx;
handle = _PyObject_Vectorcall(callable, stack, nargs, context_kwname); handle = PyObject_Vectorcall(callable, stack, nargs, context_kwname);
Py_DECREF(callable); Py_DECREF(callable);
} }
@ -1287,7 +1287,7 @@ static PyObject *
_asyncio_Future__repr_info_impl(FutureObj *self) _asyncio_Future__repr_info_impl(FutureObj *self)
/*[clinic end generated code: output=fa69e901bd176cfb input=f21504d8e2ae1ca2]*/ /*[clinic end generated code: output=fa69e901bd176cfb input=f21504d8e2ae1ca2]*/
{ {
return _PyObject_CallOneArg(asyncio_future_repr_info_func, (PyObject *)self); return PyObject_CallOneArg(asyncio_future_repr_info_func, (PyObject *)self);
} }
static PyObject * static PyObject *
@ -1363,7 +1363,7 @@ FutureObj_finalize(FutureObj *fut)
func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler); func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler);
if (func != NULL) { if (func != NULL) {
PyObject *res = _PyObject_CallOneArg(func, context); PyObject *res = PyObject_CallOneArg(func, context);
if (res == NULL) { if (res == NULL) {
PyErr_WriteUnraisable(func); PyErr_WriteUnraisable(func);
} }
@ -2126,13 +2126,13 @@ _asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop)
Py_DECREF(current_task_func); Py_DECREF(current_task_func);
return NULL; return NULL;
} }
ret = _PyObject_CallOneArg(current_task_func, loop); ret = PyObject_CallOneArg(current_task_func, loop);
Py_DECREF(current_task_func); Py_DECREF(current_task_func);
Py_DECREF(loop); Py_DECREF(loop);
return ret; return ret;
} }
else { else {
ret = _PyObject_CallOneArg(current_task_func, loop); ret = PyObject_CallOneArg(current_task_func, loop);
Py_DECREF(current_task_func); Py_DECREF(current_task_func);
return ret; return ret;
} }
@ -2168,7 +2168,7 @@ _asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop)
return NULL; return NULL;
} }
res = _PyObject_CallOneArg(all_tasks_func, loop); res = PyObject_CallOneArg(all_tasks_func, loop);
Py_DECREF(all_tasks_func); Py_DECREF(all_tasks_func);
return res; return res;
} }
@ -2181,7 +2181,7 @@ static PyObject *
_asyncio_Task__repr_info_impl(TaskObj *self) _asyncio_Task__repr_info_impl(TaskObj *self)
/*[clinic end generated code: output=6a490eb66d5ba34b input=3c6d051ed3ddec8b]*/ /*[clinic end generated code: output=6a490eb66d5ba34b input=3c6d051ed3ddec8b]*/
{ {
return _PyObject_CallOneArg(asyncio_task_repr_info_func, (PyObject *)self); return PyObject_CallOneArg(asyncio_task_repr_info_func, (PyObject *)self);
} }
/*[clinic input] /*[clinic input]
@ -2431,7 +2431,7 @@ TaskObj_finalize(TaskObj *task)
func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler); func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler);
if (func != NULL) { if (func != NULL) {
PyObject *res = _PyObject_CallOneArg(func, context); PyObject *res = PyObject_CallOneArg(func, context);
if (res == NULL) { if (res == NULL) {
PyErr_WriteUnraisable(func); PyErr_WriteUnraisable(func);
} }
@ -2571,7 +2571,7 @@ task_set_error_soon(TaskObj *task, PyObject *et, const char *format, ...)
return NULL; return NULL;
} }
PyObject *e = _PyObject_CallOneArg(et, msg); PyObject *e = PyObject_CallOneArg(et, msg);
Py_DECREF(msg); Py_DECREF(msg);
if (e == NULL) { if (e == NULL) {
return NULL; return NULL;
@ -2841,7 +2841,7 @@ task_step_impl(TaskObj *task, PyObject *exc)
PyObject *stack[2]; PyObject *stack[2];
stack[0] = wrapper; stack[0] = wrapper;
stack[1] = (PyObject *)task->task_context; stack[1] = (PyObject *)task->task_context;
res = _PyObject_Vectorcall(add_cb, stack, 1, context_kwname); res = PyObject_Vectorcall(add_cb, stack, 1, context_kwname);
Py_DECREF(add_cb); Py_DECREF(add_cb);
Py_DECREF(wrapper); Py_DECREF(wrapper);
if (res == NULL) { if (res == NULL) {

View File

@ -512,7 +512,7 @@ deque_copy(PyObject *deque, PyObject *Py_UNUSED(ignored))
return NULL; return NULL;
} }
if (old_deque->maxlen < 0) if (old_deque->maxlen < 0)
result = _PyObject_CallOneArg((PyObject *)(Py_TYPE(deque)), deque); result = PyObject_CallOneArg((PyObject *)(Py_TYPE(deque)), deque);
else else
result = PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi", result = PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi",
deque, old_deque->maxlen, NULL); deque, old_deque->maxlen, NULL);

View File

@ -514,10 +514,10 @@ _call_dialect(PyObject *dialect_inst, PyObject *kwargs)
{ {
PyObject *type = (PyObject *)&Dialect_Type; PyObject *type = (PyObject *)&Dialect_Type;
if (dialect_inst) { if (dialect_inst) {
return _PyObject_FastCallDict(type, &dialect_inst, 1, kwargs); return PyObject_VectorcallDict(type, &dialect_inst, 1, kwargs);
} }
else { else {
return _PyObject_FastCallDict(type, NULL, 0, kwargs); return PyObject_VectorcallDict(type, NULL, 0, kwargs);
} }
} }
@ -1240,7 +1240,7 @@ csv_writerow(WriterObj *self, PyObject *seq)
if (line == NULL) { if (line == NULL) {
return NULL; return NULL;
} }
result = _PyObject_CallOneArg(self->write, line); result = PyObject_CallOneArg(self->write, line);
Py_DECREF(line); Py_DECREF(line);
return result; return result;
} }

View File

@ -945,7 +945,7 @@ static PyObject *GetResult(PyObject *restype, void *result, PyObject *checker)
if (!checker || !retval) if (!checker || !retval)
return retval; return retval;
v = _PyObject_CallOneArg(checker, retval); v = PyObject_CallOneArg(checker, retval);
if (v == NULL) if (v == NULL)
_PyTraceback_Add("GetResult", "_ctypes/callproc.c", __LINE__-2); _PyTraceback_Add("GetResult", "_ctypes/callproc.c", __LINE__-2);
Py_DECREF(retval); Py_DECREF(retval);
@ -1138,7 +1138,7 @@ PyObject *_ctypes_callproc(PPROC pProc,
if (argtypes && argtype_count > i) { if (argtypes && argtype_count > i) {
PyObject *v; PyObject *v;
converter = PyTuple_GET_ITEM(argtypes, i); converter = PyTuple_GET_ITEM(argtypes, i);
v = _PyObject_CallOneArg(converter, arg); v = PyObject_CallOneArg(converter, arg);
if (v == NULL) { if (v == NULL) {
_ctypes_extend_error(PyExc_ArgError, "argument %zd: ", i+1); _ctypes_extend_error(PyExc_ArgError, "argument %zd: ", i+1);
goto cleanup; goto cleanup;
@ -1835,7 +1835,7 @@ pointer(PyObject *self, PyObject *arg)
typ = PyDict_GetItemWithError(_ctypes_ptrtype_cache, (PyObject *)Py_TYPE(arg)); typ = PyDict_GetItemWithError(_ctypes_ptrtype_cache, (PyObject *)Py_TYPE(arg));
if (typ) { if (typ) {
return _PyObject_CallOneArg(typ, arg); return PyObject_CallOneArg(typ, arg);
} }
else if (PyErr_Occurred()) { else if (PyErr_Occurred()) {
return NULL; return NULL;
@ -1843,7 +1843,7 @@ pointer(PyObject *self, PyObject *arg)
typ = POINTER(NULL, (PyObject *)Py_TYPE(arg)); typ = POINTER(NULL, (PyObject *)Py_TYPE(arg));
if (typ == NULL) if (typ == NULL)
return NULL; return NULL;
result = _PyObject_CallOneArg(typ, arg); result = PyObject_CallOneArg(typ, arg);
Py_DECREF(typ); Py_DECREF(typ);
return result; return result;
} }

View File

@ -2671,7 +2671,7 @@ treebuilder_append_event(TreeBuilderObject *self, PyObject *action,
PyObject *event = PyTuple_Pack(2, action, node); PyObject *event = PyTuple_Pack(2, action, node);
if (event == NULL) if (event == NULL)
return -1; return -1;
res = _PyObject_CallOneArg(self->events_append, event); res = PyObject_CallOneArg(self->events_append, event);
Py_DECREF(event); Py_DECREF(event);
if (res == NULL) if (res == NULL)
return -1; return -1;
@ -2837,7 +2837,7 @@ treebuilder_handle_comment(TreeBuilderObject* self, PyObject* text)
} }
if (self->comment_factory) { if (self->comment_factory) {
comment = _PyObject_CallOneArg(self->comment_factory, text); comment = PyObject_CallOneArg(self->comment_factory, text);
if (!comment) if (!comment)
return NULL; return NULL;
@ -3179,7 +3179,7 @@ expat_set_error(enum XML_Error error_code, Py_ssize_t line, Py_ssize_t column,
if (errmsg == NULL) if (errmsg == NULL)
return; return;
error = _PyObject_CallOneArg(st->parseerror_obj, errmsg); error = PyObject_CallOneArg(st->parseerror_obj, errmsg);
Py_DECREF(errmsg); Py_DECREF(errmsg);
if (!error) if (!error)
return; return;
@ -3242,7 +3242,7 @@ expat_default_handler(XMLParserObject* self, const XML_Char* data_in,
(TreeBuilderObject*) self->target, value (TreeBuilderObject*) self->target, value
); );
else if (self->handle_data) else if (self->handle_data)
res = _PyObject_CallOneArg(self->handle_data, value); res = PyObject_CallOneArg(self->handle_data, value);
else else
res = NULL; res = NULL;
Py_XDECREF(res); Py_XDECREF(res);
@ -3353,7 +3353,7 @@ expat_data_handler(XMLParserObject* self, const XML_Char* data_in,
/* shortcut */ /* shortcut */
res = treebuilder_handle_data((TreeBuilderObject*) self->target, data); res = treebuilder_handle_data((TreeBuilderObject*) self->target, data);
else if (self->handle_data) else if (self->handle_data)
res = _PyObject_CallOneArg(self->handle_data, data); res = PyObject_CallOneArg(self->handle_data, data);
else else
res = NULL; res = NULL;
@ -3380,7 +3380,7 @@ expat_end_handler(XMLParserObject* self, const XML_Char* tag_in)
else if (self->handle_end) { else if (self->handle_end) {
tag = makeuniversal(self, tag_in); tag = makeuniversal(self, tag_in);
if (tag) { if (tag) {
res = _PyObject_CallOneArg(self->handle_end, tag); res = PyObject_CallOneArg(self->handle_end, tag);
Py_DECREF(tag); Py_DECREF(tag);
} }
} }
@ -3467,7 +3467,7 @@ expat_end_ns_handler(XMLParserObject* self, const XML_Char* prefix_in)
if (!prefix) if (!prefix)
return; return;
res = _PyObject_CallOneArg(self->handle_end_ns, prefix); res = PyObject_CallOneArg(self->handle_end_ns, prefix);
Py_DECREF(prefix); Py_DECREF(prefix);
} }
@ -3499,7 +3499,7 @@ expat_comment_handler(XMLParserObject* self, const XML_Char* comment_in)
if (!comment) if (!comment)
return; return;
res = _PyObject_CallOneArg(self->handle_comment, comment); res = PyObject_CallOneArg(self->handle_comment, comment);
Py_XDECREF(res); Py_XDECREF(res);
Py_DECREF(comment); Py_DECREF(comment);
} }

View File

@ -213,7 +213,7 @@ partial_vectorcall(partialobject *pto, PyObject *const *args,
static void static void
partial_setvectorcall(partialobject *pto) partial_setvectorcall(partialobject *pto)
{ {
if (_PyVectorcall_Function(pto->fn) == NULL) { if (PyVectorcall_Function(pto->fn) == NULL) {
/* Don't use vectorcall if the underlying function doesn't support it */ /* Don't use vectorcall if the underlying function doesn't support it */
pto->vectorcall = NULL; pto->vectorcall = NULL;
} }
@ -440,7 +440,7 @@ static PyTypeObject partial_type = {
0, /* tp_as_buffer */ 0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE | Py_TPFLAGS_BASETYPE |
_Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */ Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
partial_doc, /* tp_doc */ partial_doc, /* tp_doc */
(traverseproc)partial_traverse, /* tp_traverse */ (traverseproc)partial_traverse, /* tp_traverse */
0, /* tp_clear */ 0, /* tp_clear */

View File

@ -461,7 +461,7 @@ static PyObject *
buffered_simple_flush(buffered *self, PyObject *args) buffered_simple_flush(buffered *self, PyObject *args)
{ {
CHECK_INITIALIZED(self) CHECK_INITIALIZED(self)
return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_flush); return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_flush);
} }
static int static int
@ -513,7 +513,7 @@ buffered_close(buffered *self, PyObject *args)
} }
/* flush() will most probably re-take the lock, so drop it first */ /* flush() will most probably re-take the lock, so drop it first */
LEAVE_BUFFERED(self) LEAVE_BUFFERED(self)
res = _PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush); res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (!ENTER_BUFFERED(self)) if (!ENTER_BUFFERED(self))
return NULL; return NULL;
if (res == NULL) if (res == NULL)
@ -521,7 +521,7 @@ buffered_close(buffered *self, PyObject *args)
else else
Py_DECREF(res); Py_DECREF(res);
res = _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_close); res = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_close);
if (self->buffer) { if (self->buffer) {
PyMem_Free(self->buffer); PyMem_Free(self->buffer);
@ -545,7 +545,7 @@ buffered_detach(buffered *self, PyObject *Py_UNUSED(ignored))
{ {
PyObject *raw, *res; PyObject *raw, *res;
CHECK_INITIALIZED(self) CHECK_INITIALIZED(self)
res = _PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush); res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL) if (res == NULL)
return NULL; return NULL;
Py_DECREF(res); Py_DECREF(res);
@ -562,21 +562,21 @@ static PyObject *
buffered_seekable(buffered *self, PyObject *Py_UNUSED(ignored)) buffered_seekable(buffered *self, PyObject *Py_UNUSED(ignored))
{ {
CHECK_INITIALIZED(self) CHECK_INITIALIZED(self)
return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_seekable); return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_seekable);
} }
static PyObject * static PyObject *
buffered_readable(buffered *self, PyObject *Py_UNUSED(ignored)) buffered_readable(buffered *self, PyObject *Py_UNUSED(ignored))
{ {
CHECK_INITIALIZED(self) CHECK_INITIALIZED(self)
return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_readable); return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_readable);
} }
static PyObject * static PyObject *
buffered_writable(buffered *self, PyObject *Py_UNUSED(ignored)) buffered_writable(buffered *self, PyObject *Py_UNUSED(ignored))
{ {
CHECK_INITIALIZED(self) CHECK_INITIALIZED(self)
return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_writable); return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_writable);
} }
static PyObject * static PyObject *
@ -599,14 +599,14 @@ static PyObject *
buffered_fileno(buffered *self, PyObject *Py_UNUSED(ignored)) buffered_fileno(buffered *self, PyObject *Py_UNUSED(ignored))
{ {
CHECK_INITIALIZED(self) CHECK_INITIALIZED(self)
return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_fileno); return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_fileno);
} }
static PyObject * static PyObject *
buffered_isatty(buffered *self, PyObject *Py_UNUSED(ignored)) buffered_isatty(buffered *self, PyObject *Py_UNUSED(ignored))
{ {
CHECK_INITIALIZED(self) CHECK_INITIALIZED(self)
return _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_isatty); return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_isatty);
} }
/* Forward decls */ /* Forward decls */
@ -670,7 +670,7 @@ _buffered_raw_tell(buffered *self)
{ {
Py_off_t n; Py_off_t n;
PyObject *res; PyObject *res;
res = _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_tell); res = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_tell);
if (res == NULL) if (res == NULL)
return -1; return -1;
n = PyNumber_AsOff_t(res, PyExc_ValueError); n = PyNumber_AsOff_t(res, PyExc_ValueError);
@ -1324,7 +1324,7 @@ _io__Buffered_truncate_impl(buffered *self, PyObject *pos)
goto end; goto end;
Py_CLEAR(res); Py_CLEAR(res);
} }
res = _PyObject_CallMethodOneArg(self->raw, _PyIO_str_truncate, pos); res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_truncate, pos);
if (res == NULL) if (res == NULL)
goto end; goto end;
/* Reset cached position */ /* Reset cached position */
@ -1351,7 +1351,7 @@ buffered_iternext(buffered *self)
line = _buffered_readline(self, -1); line = _buffered_readline(self, -1);
} }
else { else {
line = _PyObject_CallMethodNoArgs((PyObject *)self, line = PyObject_CallMethodNoArgs((PyObject *)self,
_PyIO_str_readline); _PyIO_str_readline);
if (line && !PyBytes_Check(line)) { if (line && !PyBytes_Check(line)) {
PyErr_Format(PyExc_OSError, PyErr_Format(PyExc_OSError,
@ -1470,7 +1470,7 @@ _bufferedreader_raw_read(buffered *self, char *start, Py_ssize_t len)
raised (see issue #10956). raised (see issue #10956).
*/ */
do { do {
res = _PyObject_CallMethodOneArg(self->raw, _PyIO_str_readinto, memobj); res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_readinto, memobj);
} while (res == NULL && _PyIO_trap_eintr()); } while (res == NULL && _PyIO_trap_eintr());
Py_DECREF(memobj); Py_DECREF(memobj);
if (res == NULL) if (res == NULL)
@ -1569,7 +1569,7 @@ _bufferedreader_read_all(buffered *self)
} }
/* Read until EOF or until read() would block. */ /* Read until EOF or until read() would block. */
data = _PyObject_CallMethodNoArgs(self->raw, _PyIO_str_read); data = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_read);
if (data == NULL) if (data == NULL)
goto cleanup; goto cleanup;
if (data != Py_None && !PyBytes_Check(data)) { if (data != Py_None && !PyBytes_Check(data)) {
@ -1818,7 +1818,7 @@ _bufferedwriter_raw_write(buffered *self, char *start, Py_ssize_t len)
*/ */
do { do {
errno = 0; errno = 0;
res = _PyObject_CallMethodOneArg(self->raw, _PyIO_str_write, memobj); res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_write, memobj);
errnum = errno; errnum = errno;
} while (res == NULL && _PyIO_trap_eintr()); } while (res == NULL && _PyIO_trap_eintr());
Py_DECREF(memobj); Py_DECREF(memobj);

View File

@ -235,7 +235,7 @@ _io__IOBase_close_impl(PyObject *self)
Py_RETURN_NONE; Py_RETURN_NONE;
} }
res = _PyObject_CallMethodNoArgs(self, _PyIO_str_flush); res = PyObject_CallMethodNoArgs(self, _PyIO_str_flush);
PyErr_Fetch(&exc, &val, &tb); PyErr_Fetch(&exc, &val, &tb);
rc = _PyObject_SetAttrId(self, &PyId___IOBase_closed, Py_True); rc = _PyObject_SetAttrId(self, &PyId___IOBase_closed, Py_True);
@ -281,7 +281,7 @@ iobase_finalize(PyObject *self)
finalization process. */ finalization process. */
if (_PyObject_SetAttrId(self, &PyId__finalizing, Py_True)) if (_PyObject_SetAttrId(self, &PyId__finalizing, Py_True))
PyErr_Clear(); PyErr_Clear();
res = _PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_close); res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_close);
/* Silencing I/O errors is bad, but printing spurious tracebacks is /* Silencing I/O errors is bad, but printing spurious tracebacks is
equally as bad, and potentially more frequent (because of equally as bad, and potentially more frequent (because of
shutdown issues). */ shutdown issues). */
@ -382,7 +382,7 @@ _io__IOBase_seekable_impl(PyObject *self)
PyObject * PyObject *
_PyIOBase_check_seekable(PyObject *self, PyObject *args) _PyIOBase_check_seekable(PyObject *self, PyObject *args)
{ {
PyObject *res = _PyObject_CallMethodNoArgs(self, _PyIO_str_seekable); PyObject *res = PyObject_CallMethodNoArgs(self, _PyIO_str_seekable);
if (res == NULL) if (res == NULL)
return NULL; return NULL;
if (res != Py_True) { if (res != Py_True) {
@ -415,7 +415,7 @@ _io__IOBase_readable_impl(PyObject *self)
PyObject * PyObject *
_PyIOBase_check_readable(PyObject *self, PyObject *args) _PyIOBase_check_readable(PyObject *self, PyObject *args)
{ {
PyObject *res = _PyObject_CallMethodNoArgs(self, _PyIO_str_readable); PyObject *res = PyObject_CallMethodNoArgs(self, _PyIO_str_readable);
if (res == NULL) if (res == NULL)
return NULL; return NULL;
if (res != Py_True) { if (res != Py_True) {
@ -448,7 +448,7 @@ _io__IOBase_writable_impl(PyObject *self)
PyObject * PyObject *
_PyIOBase_check_writable(PyObject *self, PyObject *args) _PyIOBase_check_writable(PyObject *self, PyObject *args)
{ {
PyObject *res = _PyObject_CallMethodNoArgs(self, _PyIO_str_writable); PyObject *res = PyObject_CallMethodNoArgs(self, _PyIO_str_writable);
if (res == NULL) if (res == NULL)
return NULL; return NULL;
if (res != Py_True) { if (res != Py_True) {
@ -477,7 +477,7 @@ iobase_enter(PyObject *self, PyObject *args)
static PyObject * static PyObject *
iobase_exit(PyObject *self, PyObject *args) iobase_exit(PyObject *self, PyObject *args)
{ {
return _PyObject_CallMethodNoArgs(self, _PyIO_str_close); return PyObject_CallMethodNoArgs(self, _PyIO_str_close);
} }
/* Lower-level APIs */ /* Lower-level APIs */
@ -556,7 +556,7 @@ _io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit)
PyObject *b; PyObject *b;
if (peek != NULL) { if (peek != NULL) {
PyObject *readahead = _PyObject_CallOneArg(peek, _PyLong_One); PyObject *readahead = PyObject_CallOneArg(peek, _PyLong_One);
if (readahead == NULL) { if (readahead == NULL) {
/* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals() /* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals()
when EINTR occurs so we needn't do it ourselves. */ when EINTR occurs so we needn't do it ourselves. */
@ -655,7 +655,7 @@ iobase_iter(PyObject *self)
static PyObject * static PyObject *
iobase_iternext(PyObject *self) iobase_iternext(PyObject *self)
{ {
PyObject *line = _PyObject_CallMethodNoArgs(self, _PyIO_str_readline); PyObject *line = PyObject_CallMethodNoArgs(self, _PyIO_str_readline);
if (line == NULL) if (line == NULL)
return NULL; return NULL;

View File

@ -408,7 +408,7 @@ stringio_iternext(stringio *self)
} }
else { else {
/* XXX is subclassing StringIO really supported? */ /* XXX is subclassing StringIO really supported? */
line = _PyObject_CallMethodNoArgs((PyObject *)self, line = PyObject_CallMethodNoArgs((PyObject *)self,
_PyIO_str_readline); _PyIO_str_readline);
if (line && !PyUnicode_Check(line)) { if (line && !PyUnicode_Check(line)) {
PyErr_Format(PyExc_OSError, PyErr_Format(PyExc_OSError,

View File

@ -527,7 +527,7 @@ _io_IncrementalNewlineDecoder_getstate_impl(nldecoder_object *self)
unsigned long long flag; unsigned long long flag;
if (self->decoder != Py_None) { if (self->decoder != Py_None) {
PyObject *state = _PyObject_CallMethodNoArgs(self->decoder, PyObject *state = PyObject_CallMethodNoArgs(self->decoder,
_PyIO_str_getstate); _PyIO_str_getstate);
if (state == NULL) if (state == NULL)
return NULL; return NULL;
@ -601,7 +601,7 @@ _io_IncrementalNewlineDecoder_reset_impl(nldecoder_object *self)
self->seennl = 0; self->seennl = 0;
self->pendingcr = 0; self->pendingcr = 0;
if (self->decoder != Py_None) if (self->decoder != Py_None)
return _PyObject_CallMethodNoArgs(self->decoder, _PyIO_str_reset); return PyObject_CallMethodNoArgs(self->decoder, _PyIO_str_reset);
else else
Py_RETURN_NONE; Py_RETURN_NONE;
} }
@ -963,7 +963,7 @@ _textiowrapper_fix_encoder_state(textio *self)
self->encoding_start_of_stream = 1; self->encoding_start_of_stream = 1;
PyObject *cookieObj = _PyObject_CallMethodNoArgs( PyObject *cookieObj = PyObject_CallMethodNoArgs(
self->buffer, _PyIO_str_tell); self->buffer, _PyIO_str_tell);
if (cookieObj == NULL) { if (cookieObj == NULL) {
return -1; return -1;
@ -977,7 +977,7 @@ _textiowrapper_fix_encoder_state(textio *self)
if (cmp == 0) { if (cmp == 0) {
self->encoding_start_of_stream = 0; self->encoding_start_of_stream = 0;
PyObject *res = _PyObject_CallMethodOneArg( PyObject *res = PyObject_CallMethodOneArg(
self->encoder, _PyIO_str_setstate, _PyLong_Zero); self->encoder, _PyIO_str_setstate, _PyLong_Zero);
if (res == NULL) { if (res == NULL) {
return -1; return -1;
@ -1386,7 +1386,7 @@ _io_TextIOWrapper_reconfigure_impl(textio *self, PyObject *encoding,
return NULL; return NULL;
} }
PyObject *res = _PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush); PyObject *res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL) { if (res == NULL) {
return NULL; return NULL;
} }
@ -1525,7 +1525,7 @@ _io_TextIOWrapper_detach_impl(textio *self)
{ {
PyObject *buffer, *res; PyObject *buffer, *res;
CHECK_ATTACHED(self); CHECK_ATTACHED(self);
res = _PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush); res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL) if (res == NULL)
return NULL; return NULL;
Py_DECREF(res); Py_DECREF(res);
@ -1597,7 +1597,7 @@ _textiowrapper_writeflush(textio *self)
PyObject *ret; PyObject *ret;
do { do {
ret = _PyObject_CallMethodOneArg(self->buffer, _PyIO_str_write, b); ret = PyObject_CallMethodOneArg(self->buffer, _PyIO_str_write, b);
} while (ret == NULL && _PyIO_trap_eintr()); } while (ret == NULL && _PyIO_trap_eintr());
Py_DECREF(b); Py_DECREF(b);
if (ret == NULL) if (ret == NULL)
@ -1667,7 +1667,7 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text)
self->encoding_start_of_stream = 0; self->encoding_start_of_stream = 0;
} }
else else
b = _PyObject_CallMethodOneArg(self->encoder, _PyIO_str_encode, text); b = PyObject_CallMethodOneArg(self->encoder, _PyIO_str_encode, text);
Py_DECREF(text); Py_DECREF(text);
if (b == NULL) if (b == NULL)
@ -1718,7 +1718,7 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text)
} }
if (needflush) { if (needflush) {
ret = _PyObject_CallMethodNoArgs(self->buffer, _PyIO_str_flush); ret = PyObject_CallMethodNoArgs(self->buffer, _PyIO_str_flush);
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
Py_DECREF(ret); Py_DECREF(ret);
@ -1808,7 +1808,7 @@ textiowrapper_read_chunk(textio *self, Py_ssize_t size_hint)
/* To prepare for tell(), we need to snapshot a point in the file /* To prepare for tell(), we need to snapshot a point in the file
* where the decoder's input buffer is empty. * where the decoder's input buffer is empty.
*/ */
PyObject *state = _PyObject_CallMethodNoArgs(self->decoder, PyObject *state = PyObject_CallMethodNoArgs(self->decoder,
_PyIO_str_getstate); _PyIO_str_getstate);
if (state == NULL) if (state == NULL)
return -1; return -1;
@ -1849,7 +1849,7 @@ textiowrapper_read_chunk(textio *self, Py_ssize_t size_hint)
if (chunk_size == NULL) if (chunk_size == NULL)
goto fail; goto fail;
input_chunk = _PyObject_CallMethodOneArg(self->buffer, input_chunk = PyObject_CallMethodOneArg(self->buffer,
(self->has_read1 ? _PyIO_str_read1: _PyIO_str_read), (self->has_read1 ? _PyIO_str_read1: _PyIO_str_read),
chunk_size); chunk_size);
Py_DECREF(chunk_size); Py_DECREF(chunk_size);
@ -2393,7 +2393,7 @@ _textiowrapper_decoder_setstate(textio *self, cookie_type *cookie)
utf-16, that we are expecting a BOM). utf-16, that we are expecting a BOM).
*/ */
if (cookie->start_pos == 0 && cookie->dec_flags == 0) if (cookie->start_pos == 0 && cookie->dec_flags == 0)
res = _PyObject_CallMethodNoArgs(self->decoder, _PyIO_str_reset); res = PyObject_CallMethodNoArgs(self->decoder, _PyIO_str_reset);
else else
res = _PyObject_CallMethodId(self->decoder, &PyId_setstate, res = _PyObject_CallMethodId(self->decoder, &PyId_setstate,
"((yi))", "", cookie->dec_flags); "((yi))", "", cookie->dec_flags);
@ -2408,11 +2408,11 @@ _textiowrapper_encoder_reset(textio *self, int start_of_stream)
{ {
PyObject *res; PyObject *res;
if (start_of_stream) { if (start_of_stream) {
res = _PyObject_CallMethodNoArgs(self->encoder, _PyIO_str_reset); res = PyObject_CallMethodNoArgs(self->encoder, _PyIO_str_reset);
self->encoding_start_of_stream = 1; self->encoding_start_of_stream = 1;
} }
else { else {
res = _PyObject_CallMethodOneArg(self->encoder, _PyIO_str_setstate, res = PyObject_CallMethodOneArg(self->encoder, _PyIO_str_setstate,
_PyLong_Zero); _PyLong_Zero);
self->encoding_start_of_stream = 0; self->encoding_start_of_stream = 0;
} }
@ -2537,7 +2537,7 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
goto fail; goto fail;
} }
res = _PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush); res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL) if (res == NULL)
goto fail; goto fail;
Py_DECREF(res); Py_DECREF(res);
@ -2552,7 +2552,7 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
posobj = PyLong_FromOff_t(cookie.start_pos); posobj = PyLong_FromOff_t(cookie.start_pos);
if (posobj == NULL) if (posobj == NULL)
goto fail; goto fail;
res = _PyObject_CallMethodOneArg(self->buffer, _PyIO_str_seek, posobj); res = PyObject_CallMethodOneArg(self->buffer, _PyIO_str_seek, posobj);
Py_DECREF(posobj); Py_DECREF(posobj);
if (res == NULL) if (res == NULL)
goto fail; goto fail;
@ -2700,14 +2700,14 @@ _io_TextIOWrapper_tell_impl(textio *self)
chars_to_skip = self->decoded_chars_used; chars_to_skip = self->decoded_chars_used;
/* Decoder state will be restored at the end */ /* Decoder state will be restored at the end */
saved_state = _PyObject_CallMethodNoArgs(self->decoder, saved_state = PyObject_CallMethodNoArgs(self->decoder,
_PyIO_str_getstate); _PyIO_str_getstate);
if (saved_state == NULL) if (saved_state == NULL)
goto fail; goto fail;
#define DECODER_GETSTATE() do { \ #define DECODER_GETSTATE() do { \
PyObject *dec_buffer; \ PyObject *dec_buffer; \
PyObject *_state = _PyObject_CallMethodNoArgs(self->decoder, \ PyObject *_state = PyObject_CallMethodNoArgs(self->decoder, \
_PyIO_str_getstate); \ _PyIO_str_getstate); \
if (_state == NULL) \ if (_state == NULL) \
goto fail; \ goto fail; \
@ -2870,12 +2870,12 @@ _io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos)
CHECK_ATTACHED(self) CHECK_ATTACHED(self)
res = _PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush); res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL) if (res == NULL)
return NULL; return NULL;
Py_DECREF(res); Py_DECREF(res);
return _PyObject_CallMethodOneArg(self->buffer, _PyIO_str_truncate, pos); return PyObject_CallMethodOneArg(self->buffer, _PyIO_str_truncate, pos);
} }
static PyObject * static PyObject *
@ -3084,7 +3084,7 @@ textiowrapper_iternext(textio *self)
line = _textiowrapper_readline(self, -1); line = _textiowrapper_readline(self, -1);
} }
else { else {
line = _PyObject_CallMethodNoArgs((PyObject *)self, line = PyObject_CallMethodNoArgs((PyObject *)self,
_PyIO_str_readline); _PyIO_str_readline);
if (line && !PyUnicode_Check(line)) { if (line && !PyUnicode_Check(line)) {
PyErr_Format(PyExc_OSError, PyErr_Format(PyExc_OSError,

View File

@ -777,14 +777,14 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
*next_idx_ptr = idx + 1; *next_idx_ptr = idx + 1;
if (has_pairs_hook) { if (has_pairs_hook) {
val = _PyObject_CallOneArg(s->object_pairs_hook, rval); val = PyObject_CallOneArg(s->object_pairs_hook, rval);
Py_DECREF(rval); Py_DECREF(rval);
return val; return val;
} }
/* if object_hook is not None: rval = object_hook(rval) */ /* if object_hook is not None: rval = object_hook(rval) */
if (s->object_hook != Py_None) { if (s->object_hook != Py_None) {
val = _PyObject_CallOneArg(s->object_hook, rval); val = PyObject_CallOneArg(s->object_hook, rval);
Py_DECREF(rval); Py_DECREF(rval);
return val; return val;
} }
@ -890,7 +890,7 @@ _parse_constant(PyScannerObject *s, const char *constant, Py_ssize_t idx, Py_ssi
return NULL; return NULL;
/* rval = parse_constant(constant) */ /* rval = parse_constant(constant) */
rval = _PyObject_CallOneArg(s->parse_constant, cstr); rval = PyObject_CallOneArg(s->parse_constant, cstr);
idx += PyUnicode_GET_LENGTH(cstr); idx += PyUnicode_GET_LENGTH(cstr);
Py_DECREF(cstr); Py_DECREF(cstr);
*next_idx_ptr = idx; *next_idx_ptr = idx;
@ -989,7 +989,7 @@ _match_number_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_
idx - start); idx - start);
if (numstr == NULL) if (numstr == NULL)
return NULL; return NULL;
rval = _PyObject_CallOneArg(custom_func, numstr); rval = PyObject_CallOneArg(custom_func, numstr);
} }
else { else {
Py_ssize_t i, n; Py_ssize_t i, n;
@ -1399,7 +1399,7 @@ encoder_encode_string(PyEncoderObject *s, PyObject *obj)
if (s->fast_encode) { if (s->fast_encode) {
return s->fast_encode(NULL, obj); return s->fast_encode(NULL, obj);
} }
encoded = _PyObject_CallOneArg(s->encoder, obj); encoded = PyObject_CallOneArg(s->encoder, obj);
if (encoded != NULL && !PyUnicode_Check(encoded)) { if (encoded != NULL && !PyUnicode_Check(encoded)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"encoder() must return a string, not %.80s", "encoder() must return a string, not %.80s",
@ -1485,7 +1485,7 @@ encoder_listencode_obj(PyEncoderObject *s, _PyAccu *acc,
return -1; return -1;
} }
} }
newobj = _PyObject_CallOneArg(s->defaultfn, obj); newobj = PyObject_CallOneArg(s->defaultfn, obj);
if (newobj == NULL) { if (newobj == NULL) {
Py_XDECREF(ident); Py_XDECREF(ident);
return -1; return -1;

View File

@ -1682,7 +1682,7 @@ methodcaller_reduce(methodcallerobject *mc, PyObject *Py_UNUSED(ignored))
newargs[0] = (PyObject *)Py_TYPE(mc); newargs[0] = (PyObject *)Py_TYPE(mc);
newargs[1] = mc->name; newargs[1] = mc->name;
constructor = _PyObject_FastCallDict(partial, newargs, 2, mc->kwds); constructor = PyObject_VectorcallDict(partial, newargs, 2, mc->kwds);
Py_DECREF(partial); Py_DECREF(partial);
return Py_BuildValue("NO", constructor, mc->args); return Py_BuildValue("NO", constructor, mc->args);

View File

@ -359,7 +359,7 @@ _Pickle_FastCall(PyObject *func, PyObject *obj)
{ {
PyObject *result; PyObject *result;
result = _PyObject_CallOneArg(func, obj); result = PyObject_CallOneArg(func, obj);
Py_DECREF(obj); Py_DECREF(obj);
return result; return result;
} }
@ -420,7 +420,7 @@ call_method(PyObject *func, PyObject *self, PyObject *obj)
return PyObject_CallFunctionObjArgs(func, self, obj, NULL); return PyObject_CallFunctionObjArgs(func, self, obj, NULL);
} }
else { else {
return _PyObject_CallOneArg(func, obj); return PyObject_CallOneArg(func, obj);
} }
} }
@ -2298,7 +2298,7 @@ _Pickler_write_bytes(PicklerObject *self,
return -1; return -1;
} }
} }
result = _PyObject_CallOneArg(self->write, payload); result = PyObject_CallOneArg(self->write, payload);
Py_XDECREF(mem); Py_XDECREF(mem);
if (result == NULL) { if (result == NULL) {
return -1; return -1;
@ -2506,7 +2506,7 @@ save_picklebuffer(PicklerObject *self, PyObject *obj)
} }
int in_band = 1; int in_band = 1;
if (self->buffer_callback != NULL) { if (self->buffer_callback != NULL) {
PyObject *ret = _PyObject_CallOneArg(self->buffer_callback, obj); PyObject *ret = PyObject_CallOneArg(self->buffer_callback, obj);
if (ret == NULL) { if (ret == NULL) {
return -1; return -1;
} }
@ -4323,7 +4323,7 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
* regular reduction mechanism. * regular reduction mechanism.
*/ */
if (self->reducer_override != NULL) { if (self->reducer_override != NULL) {
reduce_value = _PyObject_CallOneArg(self->reducer_override, obj); reduce_value = PyObject_CallOneArg(self->reducer_override, obj);
if (reduce_value == NULL) { if (reduce_value == NULL) {
goto error; goto error;
} }

View File

@ -80,7 +80,7 @@ _enable_gc(int need_to_reenable_gc, PyObject *gc_module)
if (need_to_reenable_gc) { if (need_to_reenable_gc) {
PyErr_Fetch(&exctype, &val, &tb); PyErr_Fetch(&exctype, &val, &tb);
result = _PyObject_CallMethodNoArgs( result = PyObject_CallMethodNoArgs(
gc_module, _posixsubprocessstate_global->enable); gc_module, _posixsubprocessstate_global->enable);
if (exctype != NULL) { if (exctype != NULL) {
PyErr_Restore(exctype, val, tb); PyErr_Restore(exctype, val, tb);
@ -657,7 +657,7 @@ subprocess_fork_exec(PyObject* self, PyObject *args)
gc_module = PyImport_ImportModule("gc"); gc_module = PyImport_ImportModule("gc");
if (gc_module == NULL) if (gc_module == NULL)
return NULL; return NULL;
result = _PyObject_CallMethodNoArgs( result = PyObject_CallMethodNoArgs(
gc_module, _posixsubprocessstate_global->isenabled); gc_module, _posixsubprocessstate_global->isenabled);
if (result == NULL) { if (result == NULL) {
Py_DECREF(gc_module); Py_DECREF(gc_module);
@ -669,7 +669,7 @@ subprocess_fork_exec(PyObject* self, PyObject *args)
Py_DECREF(gc_module); Py_DECREF(gc_module);
return NULL; return NULL;
} }
result = _PyObject_CallMethodNoArgs( result = PyObject_CallMethodNoArgs(
gc_module, _posixsubprocessstate_global->disable); gc_module, _posixsubprocessstate_global->disable);
if (result == NULL) { if (result == NULL) {
Py_DECREF(gc_module); Py_DECREF(gc_module);

View File

@ -287,7 +287,7 @@ random_seed(RandomObject *self, PyObject *arg)
/* Calling int.__abs__() prevents calling arg.__abs__(), which might /* Calling int.__abs__() prevents calling arg.__abs__(), which might
return an invalid value. See issue #31478. */ return an invalid value. See issue #31478. */
args[0] = arg; args[0] = arg;
n = _PyObject_Vectorcall(_randomstate_global->Long___abs__, args, 0, n = PyObject_Vectorcall(_randomstate_global->Long___abs__, args, 0,
NULL); NULL);
} }
else { else {

View File

@ -183,7 +183,7 @@ PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* key)
} }
} }
/* We cannot replace this by _PyObject_CallOneArg() since /* We cannot replace this by PyObject_CallOneArg() since
* PyObject_CallFunction() has a special case when using a * PyObject_CallFunction() has a special case when using a
* single tuple as argument. */ * single tuple as argument. */
data = PyObject_CallFunction(self->factory, "O", key); data = PyObject_CallFunction(self->factory, "O", key);

View File

@ -308,7 +308,7 @@ PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args,
factory = (PyObject*)&pysqlite_CursorType; factory = (PyObject*)&pysqlite_CursorType;
} }
cursor = _PyObject_CallOneArg(factory, (PyObject *)self); cursor = PyObject_CallOneArg(factory, (PyObject *)self);
if (cursor == NULL) if (cursor == NULL)
return NULL; return NULL;
if (!PyObject_TypeCheck(cursor, &pysqlite_CursorType)) { if (!PyObject_TypeCheck(cursor, &pysqlite_CursorType)) {
@ -975,7 +975,7 @@ static void _trace_callback(void* user_arg, const char* statement_string)
py_statement = PyUnicode_DecodeUTF8(statement_string, py_statement = PyUnicode_DecodeUTF8(statement_string,
strlen(statement_string), "replace"); strlen(statement_string), "replace");
if (py_statement) { if (py_statement) {
ret = _PyObject_CallOneArg((PyObject*)user_arg, py_statement); ret = PyObject_CallOneArg((PyObject*)user_arg, py_statement);
Py_DECREF(py_statement); Py_DECREF(py_statement);
} }
@ -1472,7 +1472,7 @@ pysqlite_connection_iterdump(pysqlite_Connection* self, PyObject* args)
goto finally; goto finally;
} }
retval = _PyObject_CallOneArg(pyfn_iterdump, (PyObject *)self); retval = PyObject_CallOneArg(pyfn_iterdump, (PyObject *)self);
finally: finally:
Py_XDECREF(module); Py_XDECREF(module);

View File

@ -266,7 +266,7 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
item = PyBytes_FromStringAndSize(val_str, nbytes); item = PyBytes_FromStringAndSize(val_str, nbytes);
if (!item) if (!item)
goto error; goto error;
converted = _PyObject_CallOneArg(converter, item); converted = PyObject_CallOneArg(converter, item);
Py_DECREF(item); Py_DECREF(item);
} }
} else { } else {

View File

@ -92,7 +92,7 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
Py_DECREF(key); Py_DECREF(key);
if (adapter) { if (adapter) {
Py_INCREF(adapter); Py_INCREF(adapter);
adapted = _PyObject_CallOneArg(adapter, obj); adapted = PyObject_CallOneArg(adapter, obj);
Py_DECREF(adapter); Py_DECREF(adapter);
return adapted; return adapted;
} }
@ -105,7 +105,7 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
return NULL; return NULL;
} }
if (adapter) { if (adapter) {
adapted = _PyObject_CallOneArg(adapter, obj); adapted = PyObject_CallOneArg(adapter, obj);
Py_DECREF(adapter); Py_DECREF(adapter);
if (adapted == Py_None) { if (adapted == Py_None) {
@ -124,7 +124,7 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
return NULL; return NULL;
} }
if (adapter) { if (adapter) {
adapted = _PyObject_CallOneArg(adapter, proto); adapted = PyObject_CallOneArg(adapter, proto);
Py_DECREF(adapter); Py_DECREF(adapter);
if (adapted == Py_None) { if (adapted == Py_None) {

View File

@ -1081,7 +1081,7 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string,
match = pattern_new_match(self, &state, 1); match = pattern_new_match(self, &state, 1);
if (!match) if (!match)
goto error; goto error;
item = _PyObject_CallOneArg(filter, match); item = PyObject_CallOneArg(filter, match);
Py_DECREF(match); Py_DECREF(match);
if (!item) if (!item)
goto error; goto error;

View File

@ -2097,7 +2097,7 @@ cache_struct_converter(PyObject *fmt, PyStructObject **ptr)
return 0; return 0;
} }
s_object = _PyObject_CallOneArg(_structmodulestate_global->PyStructType, fmt); s_object = PyObject_CallOneArg(_structmodulestate_global->PyStructType, fmt);
if (s_object != NULL) { if (s_object != NULL) {
if (PyDict_GET_SIZE(cache) >= MAXCACHE) if (PyDict_GET_SIZE(cache) >= MAXCACHE)
PyDict_Clear(cache); PyDict_Clear(cache);

View File

@ -4846,7 +4846,7 @@ test_pyobject_fastcalldict(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
return _PyObject_FastCallDict(func, stack, nargs, kwargs); return PyObject_VectorcallDict(func, stack, nargs, kwargs);
} }
@ -4880,7 +4880,7 @@ test_pyobject_vectorcall(PyObject *self, PyObject *args)
PyErr_SetString(PyExc_TypeError, "kwnames must be None or a tuple"); PyErr_SetString(PyExc_TypeError, "kwnames must be None or a tuple");
return NULL; return NULL;
} }
return _PyObject_Vectorcall(func, stack, nargs, kwnames); return PyObject_Vectorcall(func, stack, nargs, kwnames);
} }
@ -5253,7 +5253,7 @@ meth_fastcall_keywords(PyObject* self, PyObject* const* args,
if (pyargs == NULL) { if (pyargs == NULL) {
return NULL; return NULL;
} }
PyObject *pykwargs = _PyObject_Vectorcall((PyObject*)&PyDict_Type, PyObject *pykwargs = PyObject_Vectorcall((PyObject*)&PyDict_Type,
args + nargs, 0, kwargs); args + nargs, 0, kwargs);
return Py_BuildValue("NNN", _null_to_none(self), pyargs, pykwargs); return Py_BuildValue("NNN", _null_to_none(self), pyargs, pykwargs);
} }
@ -6133,7 +6133,7 @@ static PyTypeObject MethodDescriptorBase_Type = {
.tp_call = PyVectorcall_Call, .tp_call = PyVectorcall_Call,
.tp_vectorcall_offset = offsetof(MethodDescriptorObject, vectorcall), .tp_vectorcall_offset = offsetof(MethodDescriptorObject, vectorcall),
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
Py_TPFLAGS_METHOD_DESCRIPTOR | _Py_TPFLAGS_HAVE_VECTORCALL, Py_TPFLAGS_METHOD_DESCRIPTOR | Py_TPFLAGS_HAVE_VECTORCALL,
.tp_descr_get = func_descr_get, .tp_descr_get = func_descr_get,
}; };
@ -6172,7 +6172,7 @@ static PyTypeObject MethodDescriptor2_Type = {
.tp_new = MethodDescriptor2_new, .tp_new = MethodDescriptor2_new,
.tp_call = PyVectorcall_Call, .tp_call = PyVectorcall_Call,
.tp_vectorcall_offset = offsetof(MethodDescriptor2Object, vectorcall), .tp_vectorcall_offset = offsetof(MethodDescriptor2Object, vectorcall),
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | _Py_TPFLAGS_HAVE_VECTORCALL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_VECTORCALL,
}; };
PyDoc_STRVAR(heapgctype__doc__, PyDoc_STRVAR(heapgctype__doc__,

View File

@ -104,7 +104,7 @@ static int fuzz_json_loads(const char* data, size_t size) {
if (input_bytes == NULL) { if (input_bytes == NULL) {
return 0; return 0;
} }
PyObject* parsed = _PyObject_CallOneArg(json_loads_method, input_bytes); PyObject* parsed = PyObject_CallOneArg(json_loads_method, input_bytes);
if (parsed == NULL) { if (parsed == NULL) {
/* Ignore ValueError as the fuzzer will more than likely /* Ignore ValueError as the fuzzer will more than likely
generate some invalid json and values */ generate some invalid json and values */
@ -263,7 +263,7 @@ static int fuzz_sre_match(const char* data, size_t size) {
PyObject* pattern = compiled_patterns[idx]; PyObject* pattern = compiled_patterns[idx];
PyObject* match_callable = PyObject_GetAttrString(pattern, "match"); PyObject* match_callable = PyObject_GetAttrString(pattern, "match");
PyObject* matches = _PyObject_CallOneArg(match_callable, to_match); PyObject* matches = PyObject_CallOneArg(match_callable, to_match);
Py_XDECREF(matches); Py_XDECREF(matches);
Py_DECREF(match_callable); Py_DECREF(match_callable);

View File

@ -291,7 +291,7 @@ getcodec(PyObject *self, PyObject *encoding)
if (codecobj == NULL) if (codecobj == NULL)
return NULL; return NULL;
r = _PyObject_CallOneArg(cofunc, codecobj); r = PyObject_CallOneArg(cofunc, codecobj);
Py_DECREF(codecobj); Py_DECREF(codecobj);
return r; return r;

View File

@ -92,7 +92,7 @@ call_error_callback(PyObject *errors, PyObject *exc)
if (cb == NULL) if (cb == NULL)
return NULL; return NULL;
r = _PyObject_CallOneArg(cb, exc); r = PyObject_CallOneArg(cb, exc);
Py_DECREF(cb); Py_DECREF(cb);
return r; return r;
} }

View File

@ -872,7 +872,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
_PyObject_ASSERT(op, callback != NULL); _PyObject_ASSERT(op, callback != NULL);
/* copy-paste of weakrefobject.c's handle_callback() */ /* copy-paste of weakrefobject.c's handle_callback() */
temp = _PyObject_CallOneArg(callback, (PyObject *)wr); temp = PyObject_CallOneArg(callback, (PyObject *)wr);
if (temp == NULL) if (temp == NULL)
PyErr_WriteUnraisable(callback); PyErr_WriteUnraisable(callback);
else else

View File

@ -134,7 +134,7 @@ groupby_step(groupbyobject *gbo)
newkey = newvalue; newkey = newvalue;
Py_INCREF(newvalue); Py_INCREF(newvalue);
} else { } else {
newkey = _PyObject_CallOneArg(gbo->keyfunc, newvalue); newkey = PyObject_CallOneArg(gbo->keyfunc, newvalue);
if (newkey == NULL) { if (newkey == NULL) {
Py_DECREF(newvalue); Py_DECREF(newvalue);
return -1; return -1;
@ -1219,7 +1219,7 @@ dropwhile_next(dropwhileobject *lz)
if (lz->start == 1) if (lz->start == 1)
return item; return item;
good = _PyObject_CallOneArg(lz->func, item); good = PyObject_CallOneArg(lz->func, item);
if (good == NULL) { if (good == NULL) {
Py_DECREF(item); Py_DECREF(item);
return NULL; return NULL;
@ -1382,7 +1382,7 @@ takewhile_next(takewhileobject *lz)
if (item == NULL) if (item == NULL)
return NULL; return NULL;
good = _PyObject_CallOneArg(lz->func, item); good = PyObject_CallOneArg(lz->func, item);
if (good == NULL) { if (good == NULL) {
Py_DECREF(item); Py_DECREF(item);
return NULL; return NULL;
@ -3918,7 +3918,7 @@ filterfalse_next(filterfalseobject *lz)
ok = PyObject_IsTrue(item); ok = PyObject_IsTrue(item);
} else { } else {
PyObject *good; PyObject *good;
good = _PyObject_CallOneArg(lz->func, item); good = PyObject_CallOneArg(lz->func, item);
if (good == NULL) { if (good == NULL) {
Py_DECREF(item); Py_DECREF(item);
return NULL; return NULL;

View File

@ -119,7 +119,7 @@ set_error(xmlparseobject *self, enum XML_Error code)
XML_ErrorString(code), lineno, column); XML_ErrorString(code), lineno, column);
if (buffer == NULL) if (buffer == NULL)
return NULL; return NULL;
err = _PyObject_CallOneArg(ErrorObject, buffer); err = PyObject_CallOneArg(ErrorObject, buffer);
Py_DECREF(buffer); Py_DECREF(buffer);
if ( err != NULL if ( err != NULL
&& set_error_attr(err, "code", code) && set_error_attr(err, "code", code)

View File

@ -179,7 +179,7 @@ PyObject_GetItem(PyObject *o, PyObject *key)
return NULL; return NULL;
} }
if (meth) { if (meth) {
result = _PyObject_CallOneArg(meth, key); result = PyObject_CallOneArg(meth, key);
Py_DECREF(meth); Py_DECREF(meth);
return result; return result;
} }
@ -780,7 +780,7 @@ PyObject_Format(PyObject *obj, PyObject *format_spec)
} }
/* And call it. */ /* And call it. */
result = _PyObject_CallOneArg(meth, format_spec); result = PyObject_CallOneArg(meth, format_spec);
Py_DECREF(meth); Py_DECREF(meth);
if (result && !PyUnicode_Check(result)) { if (result && !PyUnicode_Check(result)) {
@ -2502,7 +2502,7 @@ object_recursive_isinstance(PyThreadState *tstate, PyObject *inst, PyObject *cls
return -1; return -1;
} }
PyObject *res = _PyObject_CallOneArg(checker, inst); PyObject *res = PyObject_CallOneArg(checker, inst);
_Py_LeaveRecursiveCall(tstate); _Py_LeaveRecursiveCall(tstate);
Py_DECREF(checker); Py_DECREF(checker);
@ -2588,7 +2588,7 @@ object_issubclass(PyThreadState *tstate, PyObject *derived, PyObject *cls)
Py_DECREF(checker); Py_DECREF(checker);
return ok; return ok;
} }
PyObject *res = _PyObject_CallOneArg(checker, derived); PyObject *res = PyObject_CallOneArg(checker, derived);
_Py_LeaveRecursiveCall(tstate); _Py_LeaveRecursiveCall(tstate);
Py_DECREF(checker); Py_DECREF(checker);
if (res != NULL) { if (res != NULL) {

View File

@ -89,7 +89,7 @@ _canresize(PyByteArrayObject *self)
PyObject * PyObject *
PyByteArray_FromObject(PyObject *input) PyByteArray_FromObject(PyObject *input)
{ {
return _PyObject_CallOneArg((PyObject *)&PyByteArray_Type, input); return PyObject_CallOneArg((PyObject *)&PyByteArray_Type, input);
} }
static PyObject * static PyObject *
@ -2015,7 +2015,7 @@ bytearray_fromhex_impl(PyTypeObject *type, PyObject *string)
{ {
PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type); PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type);
if (type != &PyByteArray_Type && result != NULL) { if (type != &PyByteArray_Type && result != NULL) {
Py_SETREF(result, _PyObject_CallOneArg((PyObject *)type, result)); Py_SETREF(result, PyObject_CallOneArg((PyObject *)type, result));
} }
return result; return result;
} }

View File

@ -2259,7 +2259,7 @@ bytes_fromhex_impl(PyTypeObject *type, PyObject *string)
{ {
PyObject *result = _PyBytes_FromHex(string, 0); PyObject *result = _PyBytes_FromHex(string, 0);
if (type != &PyBytes_Type && result != NULL) { if (type != &PyBytes_Type && result != NULL) {
Py_SETREF(result, _PyObject_CallOneArg((PyObject *)type, result)); Py_SETREF(result, PyObject_CallOneArg((PyObject *)type, result));
} }
return result; return result;
} }

View File

@ -95,7 +95,7 @@ _PyObject_FastCallDictTstate(PyThreadState *tstate, PyObject *callable,
{ {
assert(callable != NULL); assert(callable != NULL);
/* _PyObject_FastCallDict() must not be called with an exception set, /* PyObject_VectorcallDict() must not be called with an exception set,
because it can clear it (directly or indirectly) and so the because it can clear it (directly or indirectly) and so the
caller loses its exception */ caller loses its exception */
assert(!_PyErr_Occurred(tstate)); assert(!_PyErr_Occurred(tstate));
@ -105,7 +105,7 @@ _PyObject_FastCallDictTstate(PyThreadState *tstate, PyObject *callable,
assert(nargs == 0 || args != NULL); assert(nargs == 0 || args != NULL);
assert(kwargs == NULL || PyDict_Check(kwargs)); assert(kwargs == NULL || PyDict_Check(kwargs));
vectorcallfunc func = _PyVectorcall_Function(callable); vectorcallfunc func = PyVectorcall_Function(callable);
if (func == NULL) { if (func == NULL) {
/* Use tp_call instead */ /* Use tp_call instead */
return _PyObject_MakeTpCall(tstate, callable, args, nargs, kwargs); return _PyObject_MakeTpCall(tstate, callable, args, nargs, kwargs);
@ -133,7 +133,7 @@ _PyObject_FastCallDictTstate(PyThreadState *tstate, PyObject *callable,
PyObject * PyObject *
_PyObject_FastCallDict(PyObject *callable, PyObject *const *args, PyObject_VectorcallDict(PyObject *callable, PyObject *const *args,
size_t nargsf, PyObject *kwargs) size_t nargsf, PyObject *kwargs)
{ {
PyThreadState *tstate = _PyThreadState_GET(); PyThreadState *tstate = _PyThreadState_GET();
@ -204,8 +204,8 @@ PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *kwargs)
{ {
PyThreadState *tstate = _PyThreadState_GET(); PyThreadState *tstate = _PyThreadState_GET();
/* get vectorcallfunc as in _PyVectorcall_Function, but without /* get vectorcallfunc as in PyVectorcall_Function, but without
* the _Py_TPFLAGS_HAVE_VECTORCALL check */ * the Py_TPFLAGS_HAVE_VECTORCALL check */
Py_ssize_t offset = Py_TYPE(callable)->tp_vectorcall_offset; Py_ssize_t offset = Py_TYPE(callable)->tp_vectorcall_offset;
if (offset <= 0) { if (offset <= 0) {
_PyErr_Format(tstate, PyExc_TypeError, _PyErr_Format(tstate, PyExc_TypeError,
@ -259,7 +259,7 @@ _PyObject_Call(PyThreadState *tstate, PyObject *callable,
assert(PyTuple_Check(args)); assert(PyTuple_Check(args));
assert(kwargs == NULL || PyDict_Check(kwargs)); assert(kwargs == NULL || PyDict_Check(kwargs));
if (_PyVectorcall_Function(callable) != NULL) { if (PyVectorcall_Function(callable) != NULL) {
return PyVectorcall_Call(callable, args, kwargs); return PyVectorcall_Call(callable, args, kwargs);
} }
else { else {
@ -796,7 +796,7 @@ object_vacall(PyThreadState *tstate, PyObject *base,
PyObject * PyObject *
_PyObject_VectorcallMethod(PyObject *name, PyObject *const *args, PyObject_VectorcallMethod(PyObject *name, PyObject *const *args,
size_t nargsf, PyObject *kwnames) size_t nargsf, PyObject *kwnames)
{ {
assert(name != NULL); assert(name != NULL);

View File

@ -350,7 +350,7 @@ PyTypeObject PyMethod_Type = {
PyObject_GenericSetAttr, /* tp_setattro */ PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */ 0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
_Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */ Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
method_doc, /* tp_doc */ method_doc, /* tp_doc */
(traverseproc)method_traverse, /* tp_traverse */ (traverseproc)method_traverse, /* tp_traverse */
0, /* tp_clear */ 0, /* tp_clear */

View File

@ -454,7 +454,7 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
if (bound == NULL) { if (bound == NULL) {
return NULL; return NULL;
} }
PyObject *res = _PyObject_FastCallDict(bound, _PyTuple_ITEMS(args)+1, PyObject *res = PyObject_VectorcallDict(bound, _PyTuple_ITEMS(args)+1,
argc-1, kwds); argc-1, kwds);
Py_DECREF(bound); Py_DECREF(bound);
return res; return res;
@ -673,7 +673,7 @@ PyTypeObject PyMethodDescr_Type = {
0, /* tp_setattro */ 0, /* tp_setattro */
0, /* tp_as_buffer */ 0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
_Py_TPFLAGS_HAVE_VECTORCALL | Py_TPFLAGS_HAVE_VECTORCALL |
Py_TPFLAGS_METHOD_DESCRIPTOR, /* tp_flags */ Py_TPFLAGS_METHOD_DESCRIPTOR, /* tp_flags */
0, /* tp_doc */ 0, /* tp_doc */
descr_traverse, /* tp_traverse */ descr_traverse, /* tp_traverse */
@ -1493,7 +1493,7 @@ property_descr_get(PyObject *self, PyObject *obj, PyObject *type)
return NULL; return NULL;
} }
return _PyObject_CallOneArg(gs->prop_get, obj); return PyObject_CallOneArg(gs->prop_get, obj);
} }
static int static int
@ -1514,7 +1514,7 @@ property_descr_set(PyObject *self, PyObject *obj, PyObject *value)
return -1; return -1;
} }
if (value == NULL) if (value == NULL)
res = _PyObject_CallOneArg(func, obj); res = PyObject_CallOneArg(func, obj);
else else
res = PyObject_CallFunctionObjArgs(func, obj, value, NULL); res = PyObject_CallFunctionObjArgs(func, obj, value, NULL);
if (res == NULL) if (res == NULL)

View File

@ -2127,7 +2127,7 @@ dict_subscript(PyDictObject *mp, PyObject *key)
_Py_IDENTIFIER(__missing__); _Py_IDENTIFIER(__missing__);
missing = _PyObject_LookupSpecial((PyObject *)mp, &PyId___missing__); missing = _PyObject_LookupSpecial((PyObject *)mp, &PyId___missing__);
if (missing != NULL) { if (missing != NULL) {
res = _PyObject_CallOneArg(missing, key); res = PyObject_CallOneArg(missing, key);
Py_DECREF(missing); Py_DECREF(missing);
return res; return res;
} }

View File

@ -137,7 +137,7 @@ PyFile_WriteObject(PyObject *v, PyObject *f, int flags)
Py_DECREF(writer); Py_DECREF(writer);
return -1; return -1;
} }
result = _PyObject_CallOneArg(writer, value); result = PyObject_CallOneArg(writer, value);
Py_DECREF(value); Py_DECREF(value);
Py_DECREF(writer); Py_DECREF(writer);
if (result == NULL) if (result == NULL)

View File

@ -1490,7 +1490,7 @@ float_fromhex(PyTypeObject *type, PyObject *string)
goto parse_error; goto parse_error;
result = PyFloat_FromDouble(negate ? -x : x); result = PyFloat_FromDouble(negate ? -x : x);
if (type != &PyFloat_Type && result != NULL) { if (type != &PyFloat_Type && result != NULL) {
Py_SETREF(result, _PyObject_CallOneArg((PyObject *)type, result)); Py_SETREF(result, PyObject_CallOneArg((PyObject *)type, result));
} }
return result; return result;

View File

@ -654,7 +654,7 @@ PyTypeObject PyFunction_Type = {
0, /* tp_setattro */ 0, /* tp_setattro */
0, /* tp_as_buffer */ 0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
_Py_TPFLAGS_HAVE_VECTORCALL | Py_TPFLAGS_HAVE_VECTORCALL |
Py_TPFLAGS_METHOD_DESCRIPTOR, /* tp_flags */ Py_TPFLAGS_METHOD_DESCRIPTOR, /* tp_flags */
func_new__doc__, /* tp_doc */ func_new__doc__, /* tp_doc */
(traverseproc)func_traverse, /* tp_traverse */ (traverseproc)func_traverse, /* tp_traverse */

View File

@ -58,7 +58,7 @@ _PyGen_Finalize(PyObject *self)
/* Save the current exception, if any. */ /* Save the current exception, if any. */
PyErr_Fetch(&error_type, &error_value, &error_traceback); PyErr_Fetch(&error_type, &error_value, &error_traceback);
res = _PyObject_CallOneArg(finalizer, self); res = PyObject_CallOneArg(finalizer, self);
if (res == NULL) { if (res == NULL) {
PyErr_WriteUnraisable(self); PyErr_WriteUnraisable(self);
@ -563,7 +563,7 @@ _PyGen_SetStopIterationValue(PyObject *value)
return 0; return 0;
} }
/* Construct an exception instance manually with /* Construct an exception instance manually with
* _PyObject_CallOneArg and pass it to PyErr_SetObject. * PyObject_CallOneArg and pass it to PyErr_SetObject.
* *
* We do this to handle a situation when "value" is a tuple, in which * We do this to handle a situation when "value" is a tuple, in which
* case PyErr_SetObject would set the value of StopIteration to * case PyErr_SetObject would set the value of StopIteration to
@ -571,7 +571,7 @@ _PyGen_SetStopIterationValue(PyObject *value)
* *
* (See PyErr_SetObject/_PyErr_CreateException code for details.) * (See PyErr_SetObject/_PyErr_CreateException code for details.)
*/ */
e = _PyObject_CallOneArg(PyExc_StopIteration, value); e = PyObject_CallOneArg(PyExc_StopIteration, value);
if (e == NULL) { if (e == NULL) {
return -1; return -1;
} }
@ -1264,7 +1264,7 @@ async_gen_init_hooks(PyAsyncGenObject *o)
PyObject *res; PyObject *res;
Py_INCREF(firstiter); Py_INCREF(firstiter);
res = _PyObject_CallOneArg(firstiter, (PyObject *)o); res = PyObject_CallOneArg(firstiter, (PyObject *)o);
Py_DECREF(firstiter); Py_DECREF(firstiter);
if (res == NULL) { if (res == NULL) {
return 1; return 1;

View File

@ -2226,7 +2226,7 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
} }
for (i = 0; i < saved_ob_size ; i++) { for (i = 0; i < saved_ob_size ; i++) {
keys[i] = _PyObject_CallOneArg(keyfunc, saved_ob_item[i]); keys[i] = PyObject_CallOneArg(keyfunc, saved_ob_item[i]);
if (keys[i] == NULL) { if (keys[i] == NULL) {
for (i=i-1 ; i>=0 ; i--) for (i=i-1 ; i>=0 ; i--)
Py_DECREF(keys[i]); Py_DECREF(keys[i]);

View File

@ -5547,7 +5547,7 @@ int_from_bytes_impl(PyTypeObject *type, PyObject *bytes_obj,
Py_DECREF(bytes); Py_DECREF(bytes);
if (long_obj != NULL && type != &PyLong_Type) { if (long_obj != NULL && type != &PyLong_Type) {
Py_SETREF(long_obj, _PyObject_CallOneArg((PyObject *)type, long_obj)); Py_SETREF(long_obj, PyObject_CallOneArg((PyObject *)type, long_obj));
} }
return long_obj; return long_obj;

View File

@ -1963,7 +1963,7 @@ struct_get_unpacker(const char *fmt, Py_ssize_t itemsize)
if (format == NULL) if (format == NULL)
goto error; goto error;
structobj = _PyObject_CallOneArg(Struct, format); structobj = PyObject_CallOneArg(Struct, format);
if (structobj == NULL) if (structobj == NULL)
goto error; goto error;
@ -2002,7 +2002,7 @@ struct_unpack_single(const char *ptr, struct unpacker *x)
PyObject *v; PyObject *v;
memcpy(x->item, ptr, x->itemsize); memcpy(x->item, ptr, x->itemsize);
v = _PyObject_CallOneArg(x->unpack_from, x->mview); v = PyObject_CallOneArg(x->unpack_from, x->mview);
if (v == NULL) if (v == NULL)
return NULL; return NULL;

View File

@ -298,7 +298,7 @@ PyTypeObject PyCFunction_Type = {
0, /* tp_setattro */ 0, /* tp_setattro */
0, /* tp_as_buffer */ 0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
_Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */ Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
0, /* tp_doc */ 0, /* tp_doc */
(traverseproc)meth_traverse, /* tp_traverse */ (traverseproc)meth_traverse, /* tp_traverse */
0, /* tp_clear */ 0, /* tp_clear */

View File

@ -738,7 +738,7 @@ module_getattro(PyModuleObject *m, PyObject *name)
_Py_IDENTIFIER(__getattr__); _Py_IDENTIFIER(__getattr__);
getattr = _PyDict_GetItemId(m->md_dict, &PyId___getattr__); getattr = _PyDict_GetItemId(m->md_dict, &PyId___getattr__);
if (getattr) { if (getattr) {
return _PyObject_CallOneArg(getattr, name); return PyObject_CallOneArg(getattr, name);
} }
mod_name = _PyDict_GetItemId(m->md_dict, &PyId___name__); mod_name = _PyDict_GetItemId(m->md_dict, &PyId___name__);
if (mod_name && PyUnicode_Check(mod_name)) { if (mod_name && PyUnicode_Check(mod_name)) {

View File

@ -1465,7 +1465,7 @@ static PyObject*
call_unbound_noarg(int unbound, PyObject *func, PyObject *self) call_unbound_noarg(int unbound, PyObject *func, PyObject *self)
{ {
if (unbound) { if (unbound) {
return _PyObject_CallOneArg(func, self); return PyObject_CallOneArg(func, self);
} }
else { else {
return _PyObject_CallNoArg(func); return _PyObject_CallNoArg(func);
@ -3665,7 +3665,7 @@ PyTypeObject PyType_Type = {
0, /* tp_as_buffer */ 0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TYPE_SUBCLASS | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TYPE_SUBCLASS |
_Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */ Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
type_doc, /* tp_doc */ type_doc, /* tp_doc */
(traverseproc)type_traverse, /* tp_traverse */ (traverseproc)type_traverse, /* tp_traverse */
(inquiry)type_clear, /* tp_clear */ (inquiry)type_clear, /* tp_clear */
@ -5196,17 +5196,17 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
/* tp_hash see tp_richcompare */ /* tp_hash see tp_richcompare */
{ {
/* Always inherit tp_vectorcall_offset to support PyVectorcall_Call(). /* Always inherit tp_vectorcall_offset to support PyVectorcall_Call().
* If _Py_TPFLAGS_HAVE_VECTORCALL is not inherited, then vectorcall * If Py_TPFLAGS_HAVE_VECTORCALL is not inherited, then vectorcall
* won't be used automatically. */ * won't be used automatically. */
COPYSLOT(tp_vectorcall_offset); COPYSLOT(tp_vectorcall_offset);
/* Inherit _Py_TPFLAGS_HAVE_VECTORCALL for non-heap types /* Inherit Py_TPFLAGS_HAVE_VECTORCALL for non-heap types
* if tp_call is not overridden */ * if tp_call is not overridden */
if (!type->tp_call && if (!type->tp_call &&
(base->tp_flags & _Py_TPFLAGS_HAVE_VECTORCALL) && (base->tp_flags & Py_TPFLAGS_HAVE_VECTORCALL) &&
!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) !(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
{ {
type->tp_flags |= _Py_TPFLAGS_HAVE_VECTORCALL; type->tp_flags |= Py_TPFLAGS_HAVE_VECTORCALL;
} }
COPYSLOT(tp_call); COPYSLOT(tp_call);
} }
@ -5282,14 +5282,14 @@ PyType_Ready(PyTypeObject *type)
/* Consistency checks for PEP 590: /* Consistency checks for PEP 590:
* - Py_TPFLAGS_METHOD_DESCRIPTOR requires tp_descr_get * - Py_TPFLAGS_METHOD_DESCRIPTOR requires tp_descr_get
* - _Py_TPFLAGS_HAVE_VECTORCALL requires tp_call and * - Py_TPFLAGS_HAVE_VECTORCALL requires tp_call and
* tp_vectorcall_offset > 0 * tp_vectorcall_offset > 0
* To avoid mistakes, we require this before inheriting. * To avoid mistakes, we require this before inheriting.
*/ */
if (type->tp_flags & Py_TPFLAGS_METHOD_DESCRIPTOR) { if (type->tp_flags & Py_TPFLAGS_METHOD_DESCRIPTOR) {
_PyObject_ASSERT((PyObject *)type, type->tp_descr_get != NULL); _PyObject_ASSERT((PyObject *)type, type->tp_descr_get != NULL);
} }
if (type->tp_flags & _Py_TPFLAGS_HAVE_VECTORCALL) { if (type->tp_flags & Py_TPFLAGS_HAVE_VECTORCALL) {
_PyObject_ASSERT((PyObject *)type, type->tp_vectorcall_offset > 0); _PyObject_ASSERT((PyObject *)type, type->tp_vectorcall_offset > 0);
_PyObject_ASSERT((PyObject *)type, type->tp_call != NULL); _PyObject_ASSERT((PyObject *)type, type->tp_call != NULL);
} }
@ -6614,7 +6614,7 @@ call_attribute(PyObject *self, PyObject *attr, PyObject *name)
else else
attr = descr; attr = descr;
} }
res = _PyObject_CallOneArg(attr, name); res = PyObject_CallOneArg(attr, name);
Py_XDECREF(descr); Py_XDECREF(descr);
return res; return res;
} }
@ -7575,7 +7575,7 @@ init_subclass(PyTypeObject *type, PyObject *kwds)
} }
result = _PyObject_FastCallDict(func, NULL, 0, kwds); result = PyObject_VectorcallDict(func, NULL, 0, kwds);
Py_DECREF(func); Py_DECREF(func);
if (result == NULL) { if (result == NULL) {
return -1; return -1;

View File

@ -4250,7 +4250,7 @@ unicode_decode_call_errorhandler_wchar(
if (*exceptionObject == NULL) if (*exceptionObject == NULL)
goto onError; goto onError;
restuple = _PyObject_CallOneArg(*errorHandler, *exceptionObject); restuple = PyObject_CallOneArg(*errorHandler, *exceptionObject);
if (restuple == NULL) if (restuple == NULL)
goto onError; goto onError;
if (!PyTuple_Check(restuple)) { if (!PyTuple_Check(restuple)) {
@ -4354,7 +4354,7 @@ unicode_decode_call_errorhandler_writer(
if (*exceptionObject == NULL) if (*exceptionObject == NULL)
goto onError; goto onError;
restuple = _PyObject_CallOneArg(*errorHandler, *exceptionObject); restuple = PyObject_CallOneArg(*errorHandler, *exceptionObject);
if (restuple == NULL) if (restuple == NULL)
goto onError; goto onError;
if (!PyTuple_Check(restuple)) { if (!PyTuple_Check(restuple)) {
@ -6801,7 +6801,7 @@ unicode_encode_call_errorhandler(const char *errors,
if (*exceptionObject == NULL) if (*exceptionObject == NULL)
return NULL; return NULL;
restuple = _PyObject_CallOneArg(*errorHandler, *exceptionObject); restuple = PyObject_CallOneArg(*errorHandler, *exceptionObject);
if (restuple == NULL) if (restuple == NULL)
return NULL; return NULL;
if (!PyTuple_Check(restuple)) { if (!PyTuple_Check(restuple)) {
@ -8783,7 +8783,7 @@ unicode_translate_call_errorhandler(const char *errors,
if (*exceptionObject == NULL) if (*exceptionObject == NULL)
return NULL; return NULL;
restuple = _PyObject_CallOneArg(*errorHandler, *exceptionObject); restuple = PyObject_CallOneArg(*errorHandler, *exceptionObject);
if (restuple == NULL) if (restuple == NULL)
return NULL; return NULL;
if (!PyTuple_Check(restuple)) { if (!PyTuple_Check(restuple)) {

View File

@ -933,7 +933,7 @@ PyWeakref_GetObject(PyObject *ref)
static void static void
handle_callback(PyWeakReference *ref, PyObject *callback) handle_callback(PyWeakReference *ref, PyObject *callback)
{ {
PyObject *cbresult = _PyObject_CallOneArg(callback, (PyObject *)ref); PyObject *cbresult = PyObject_CallOneArg(callback, (PyObject *)ref);
if (cbresult == NULL) if (cbresult == NULL)
PyErr_WriteUnraisable(callback); PyErr_WriteUnraisable(callback);

View File

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

View File

@ -56,7 +56,7 @@ update_bases(PyObject *bases, PyObject *const *args, Py_ssize_t nargs)
} }
continue; continue;
} }
new_base = _PyObject_CallOneArg(meth, bases); new_base = PyObject_CallOneArg(meth, bases);
Py_DECREF(meth); Py_DECREF(meth);
if (!new_base) { if (!new_base) {
goto error; goto error;
@ -203,7 +203,7 @@ builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
} }
else { else {
PyObject *pargs[2] = {name, bases}; PyObject *pargs[2] = {name, bases};
ns = _PyObject_FastCallDict(prep, pargs, 2, mkw); ns = PyObject_VectorcallDict(prep, pargs, 2, mkw);
Py_DECREF(prep); Py_DECREF(prep);
} }
if (ns == NULL) { if (ns == NULL) {
@ -229,7 +229,7 @@ builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
} }
} }
PyObject *margs[3] = {name, bases, ns}; PyObject *margs[3] = {name, bases, ns};
cls = _PyObject_FastCallDict(meta, margs, 3, mkw); cls = PyObject_VectorcallDict(meta, margs, 3, mkw);
if (cls != NULL && PyType_Check(cls) && PyCell_Check(cell)) { if (cls != NULL && PyType_Check(cls) && PyCell_Check(cell)) {
PyObject *cell_cls = PyCell_GET(cell); PyObject *cell_cls = PyCell_GET(cell);
if (cell_cls != cls) { if (cell_cls != cls) {
@ -489,7 +489,7 @@ builtin_breakpoint(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
} }
Py_INCREF(hook); Py_INCREF(hook);
PyObject *retval = _PyObject_Vectorcall(hook, args, nargs, keywords); PyObject *retval = PyObject_Vectorcall(hook, args, nargs, keywords);
Py_DECREF(hook); Py_DECREF(hook);
return retval; return retval;
} }
@ -575,7 +575,7 @@ filter_next(filterobject *lz)
ok = PyObject_IsTrue(item); ok = PyObject_IsTrue(item);
} else { } else {
PyObject *good; PyObject *good;
good = _PyObject_CallOneArg(lz->func, item); good = PyObject_CallOneArg(lz->func, item);
if (good == NULL) { if (good == NULL) {
Py_DECREF(item); Py_DECREF(item);
return NULL; return NULL;
@ -1631,7 +1631,7 @@ min_max(PyObject *args, PyObject *kwds, int op)
while (( item = PyIter_Next(it) )) { while (( item = PyIter_Next(it) )) {
/* get the value from the key function */ /* get the value from the key function */
if (keyfunc != NULL) { if (keyfunc != NULL) {
val = _PyObject_CallOneArg(keyfunc, item); val = PyObject_CallOneArg(keyfunc, item);
if (val == NULL) if (val == NULL)
goto Fail_it_item; goto Fail_it_item;
} }
@ -2178,7 +2178,7 @@ builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits)
if (ndigits == Py_None) if (ndigits == Py_None)
result = _PyObject_CallNoArg(round); result = _PyObject_CallNoArg(round);
else else
result = _PyObject_CallOneArg(round, ndigits); result = PyObject_CallOneArg(round, ndigits);
Py_DECREF(round); Py_DECREF(round);
return result; return result;
} }
@ -2234,7 +2234,7 @@ builtin_sorted(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
} }
assert(nargs >= 1); assert(nargs >= 1);
v = _PyObject_Vectorcall(callable, args + 1, nargs - 1, kwnames); v = PyObject_Vectorcall(callable, args + 1, nargs - 1, kwnames);
Py_DECREF(callable); Py_DECREF(callable);
if (v == NULL) { if (v == NULL) {
Py_DECREF(newlist); Py_DECREF(newlist);

View File

@ -1874,7 +1874,7 @@ main_loop:
Py_DECREF(value); Py_DECREF(value);
goto error; goto error;
} }
res = _PyObject_CallOneArg(hook, value); res = PyObject_CallOneArg(hook, value);
Py_DECREF(value); Py_DECREF(value);
if (res == NULL) if (res == NULL)
goto error; goto error;
@ -3271,7 +3271,7 @@ main_loop:
assert(!PyLong_Check(exc)); assert(!PyLong_Check(exc));
exit_func = PEEK(7); exit_func = PEEK(7);
PyObject *stack[4] = {NULL, exc, val, tb}; PyObject *stack[4] = {NULL, exc, val, tb};
res = _PyObject_Vectorcall(exit_func, stack + 1, res = PyObject_Vectorcall(exit_func, stack + 1,
3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
if (res == NULL) if (res == NULL)
goto error; goto error;
@ -4846,7 +4846,7 @@ trace_call_function(PyThreadState *tstate,
{ {
PyObject *x; PyObject *x;
if (PyCFunction_Check(func)) { if (PyCFunction_Check(func)) {
C_TRACE(x, _PyObject_Vectorcall(func, args, nargs, kwnames)); C_TRACE(x, PyObject_Vectorcall(func, args, nargs, kwnames));
return x; return x;
} }
else if (Py_TYPE(func) == &PyMethodDescr_Type && nargs > 0) { else if (Py_TYPE(func) == &PyMethodDescr_Type && nargs > 0) {
@ -4862,13 +4862,13 @@ trace_call_function(PyThreadState *tstate,
if (func == NULL) { if (func == NULL) {
return NULL; return NULL;
} }
C_TRACE(x, _PyObject_Vectorcall(func, C_TRACE(x, PyObject_Vectorcall(func,
args+1, nargs-1, args+1, nargs-1,
kwnames)); kwnames));
Py_DECREF(func); Py_DECREF(func);
return x; return x;
} }
return _PyObject_Vectorcall(func, args, nargs | PY_VECTORCALL_ARGUMENTS_OFFSET, kwnames); return PyObject_Vectorcall(func, args, nargs | PY_VECTORCALL_ARGUMENTS_OFFSET, kwnames);
} }
/* Issue #29227: Inline call_function() into _PyEval_EvalFrameDefault() /* Issue #29227: Inline call_function() into _PyEval_EvalFrameDefault()
@ -4887,7 +4887,7 @@ call_function(PyThreadState *tstate, PyObject ***pp_stack, Py_ssize_t oparg, PyO
x = trace_call_function(tstate, func, stack, nargs, kwnames); x = trace_call_function(tstate, func, stack, nargs, kwnames);
} }
else { else {
x = _PyObject_Vectorcall(func, stack, nargs | PY_VECTORCALL_ARGUMENTS_OFFSET, kwnames); x = PyObject_Vectorcall(func, stack, nargs | PY_VECTORCALL_ARGUMENTS_OFFSET, kwnames);
} }
assert((x != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); assert((x != NULL) ^ (_PyErr_Occurred(tstate) != NULL));

View File

@ -147,7 +147,7 @@ PyObject *_PyCodec_Lookup(const char *encoding)
func = PyList_GetItem(interp->codec_search_path, i); func = PyList_GetItem(interp->codec_search_path, i);
if (func == NULL) if (func == NULL)
goto onError; goto onError;
result = _PyObject_CallOneArg(func, v); result = PyObject_CallOneArg(func, v);
if (result == NULL) if (result == NULL)
goto onError; goto onError;
if (result == Py_None) { if (result == Py_None) {
@ -317,7 +317,7 @@ PyObject *codec_getstreamcodec(const char *encoding,
if (errors != NULL) if (errors != NULL)
streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors); streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors);
else else
streamcodec = _PyObject_CallOneArg(codeccls, stream); streamcodec = PyObject_CallOneArg(codeccls, stream);
Py_DECREF(codecs); Py_DECREF(codecs);
return streamcodec; return streamcodec;
} }

View File

@ -93,7 +93,7 @@ _PyErr_CreateException(PyObject *exception, PyObject *value)
return PyObject_Call(exception, value, NULL); return PyObject_Call(exception, value, NULL);
} }
else { else {
return _PyObject_CallOneArg(exception, value); return PyObject_CallOneArg(exception, value);
} }
} }
@ -907,7 +907,7 @@ PyErr_SetImportErrorSubclass(PyObject *exception, PyObject *msg,
goto done; goto done;
} }
error = _PyObject_FastCallDict(exception, &msg, 1, kwargs); error = PyObject_VectorcallDict(exception, &msg, 1, kwargs);
if (error != NULL) { if (error != NULL) {
_PyErr_SetObject(tstate, (PyObject *)Py_TYPE(error), error); _PyErr_SetObject(tstate, (PyObject *)Py_TYPE(error), error);
Py_DECREF(error); Py_DECREF(error);
@ -1422,7 +1422,7 @@ _PyErr_WriteUnraisableMsg(const char *err_msg_str, PyObject *obj)
goto default_hook; goto default_hook;
} }
PyObject *res = _PyObject_CallOneArg(hook, hook_args); PyObject *res = PyObject_CallOneArg(hook, hook_args);
Py_DECREF(hook_args); Py_DECREF(hook_args);
if (res != NULL) { if (res != NULL) {
Py_DECREF(res); Py_DECREF(res);

View File

@ -1206,7 +1206,7 @@ get_path_importer(PyThreadState *tstate, PyObject *path_importer_cache,
PyObject *hook = PyList_GetItem(path_hooks, j); PyObject *hook = PyList_GetItem(path_hooks, j);
if (hook == NULL) if (hook == NULL)
return NULL; return NULL;
importer = _PyObject_CallOneArg(hook, p); importer = PyObject_CallOneArg(hook, p);
if (importer != NULL) if (importer != NULL)
break; break;

View File

@ -519,7 +519,7 @@ sys_breakpointhook(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
return NULL; return NULL;
} }
PyMem_RawFree(envar); PyMem_RawFree(envar);
PyObject *retval = _PyObject_Vectorcall(hook, args, nargs, keywords); PyObject *retval = PyObject_Vectorcall(hook, args, nargs, keywords);
Py_DECREF(hook); Py_DECREF(hook);
return retval; return retval;