diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 66087982474..cbf5b50cc95 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -538,7 +538,7 @@ deque_copy(PyObject *deque) return NULL; } if (old_deque->maxlen < 0) - return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "O", deque, NULL); + return _PyObject_CallArg1((PyObject *)(Py_TYPE(deque)), deque); else return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi", deque, old_deque->maxlen, NULL); diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index f3e1e9f2272..bafcaa5402f 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -2831,7 +2831,7 @@ expat_set_error(enum XML_Error error_code, Py_ssize_t line, Py_ssize_t column, if (errmsg == NULL) return; - error = PyObject_CallFunction(st->parseerror_obj, "O", errmsg); + error = _PyObject_CallArg1(st->parseerror_obj, errmsg); Py_DECREF(errmsg); if (!error) return; @@ -2894,7 +2894,7 @@ expat_default_handler(XMLParserObject* self, const XML_Char* data_in, (TreeBuilderObject*) self->target, value ); else if (self->handle_data) - res = PyObject_CallFunction(self->handle_data, "O", value); + res = _PyObject_CallArg1(self->handle_data, value); else res = NULL; Py_XDECREF(res); @@ -3004,7 +3004,7 @@ expat_data_handler(XMLParserObject* self, const XML_Char* data_in, /* shortcut */ res = treebuilder_handle_data((TreeBuilderObject*) self->target, data); else if (self->handle_data) - res = PyObject_CallFunction(self->handle_data, "O", data); + res = _PyObject_CallArg1(self->handle_data, data); else res = NULL; @@ -3031,7 +3031,7 @@ expat_end_handler(XMLParserObject* self, const XML_Char* tag_in) else if (self->handle_end) { tag = makeuniversal(self, tag_in); if (tag) { - res = PyObject_CallFunction(self->handle_end, "O", tag); + res = _PyObject_CallArg1(self->handle_end, tag); Py_DECREF(tag); } } @@ -3090,7 +3090,7 @@ expat_comment_handler(XMLParserObject* self, const XML_Char* comment_in) if (self->handle_comment) { comment = PyUnicode_DecodeUTF8(comment_in, strlen(comment_in), "strict"); if (comment) { - res = PyObject_CallFunction(self->handle_comment, "O", comment); + res = _PyObject_CallArg1(self->handle_comment, comment); Py_XDECREF(res); Py_DECREF(comment); } diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index b3259d57aa1..541eee7beb0 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -119,7 +119,7 @@ set_error(xmlparseobject *self, enum XML_Error code) XML_ErrorString(code), lineno, column); if (buffer == NULL) return NULL; - err = PyObject_CallFunction(ErrorObject, "O", buffer); + err = _PyObject_CallArg1(ErrorObject, buffer); Py_DECREF(buffer); if ( err != NULL && set_error_attr(err, "code", code) diff --git a/Modules/readline.c b/Modules/readline.c index 3b94d4a0d1d..389954f0871 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -868,7 +868,7 @@ on_hook(PyObject *func) int result = 0; if (func != NULL) { PyObject *r; - r = PyObject_CallFunction(func, NULL); + r = _PyObject_CallNoArg(func); if (r == NULL) goto error; if (r == Py_None) diff --git a/Objects/genobject.c b/Objects/genobject.c index 1db83c9d64b..0484b1c6777 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -1341,7 +1341,7 @@ async_gen_init_hooks(PyAsyncGenObject *o) PyObject *res; Py_INCREF(firstiter); - res = PyObject_CallFunction(firstiter, "O", o); + res = _PyObject_CallArg1(firstiter, o); Py_DECREF(firstiter); if (res == NULL) { return 1; diff --git a/Python/_warnings.c b/Python/_warnings.c index a4ce7d19251..1b2c6cdfd42 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -476,7 +476,7 @@ warn_explicit(PyObject *category, PyObject *message, } else { text = message; - message = PyObject_CallFunction(category, "O", message); + message = _PyObject_CallArg1(category, message); if (message == NULL) goto cleanup; } diff --git a/Python/codecs.c b/Python/codecs.c index bf152c2e56f..55f6ca85e3c 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -284,7 +284,7 @@ PyObject *codec_makeincrementalcodec(PyObject *codec_info, if (errors) ret = PyObject_CallFunction(inccodec, "s", errors); else - ret = PyObject_CallFunction(inccodec, NULL); + ret = _PyObject_CallNoArg(inccodec); Py_DECREF(inccodec); return ret; } @@ -322,7 +322,7 @@ PyObject *codec_getstreamcodec(const char *encoding, if (errors != NULL) streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors); else - streamcodec = PyObject_CallFunction(codeccls, "O", stream); + streamcodec = _PyObject_CallArg1(codeccls, stream); Py_DECREF(codecs); return streamcodec; } diff --git a/Python/marshal.c b/Python/marshal.c index 87a4b240a41..0889e410505 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1274,7 +1274,7 @@ r_object(RFILE *p) if (n == 0 && type == TYPE_FROZENSET) { /* call frozenset() to get the empty frozenset singleton */ - v = PyObject_CallFunction((PyObject*)&PyFrozenSet_Type, NULL); + v = _PyObject_CallNoArg((PyObject*)&PyFrozenSet_Type); if (v == NULL) break; R_REF(v);