diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-12-05 17:04:32 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-12-05 17:04:32 +0100 |
commit | 40273ec4f37c65c13a09d0ac23b08c99ebe2f1a3 (patch) | |
tree | e843389bf11bcc519d75967e52d9a4ddc04f0b1e /Modules | |
parent | 0a0cf9e33e1c7355efbbb00702d59f66f1a02df6 (diff) | |
download | cpython-40273ec4f37c65c13a09d0ac23b08c99ebe2f1a3.tar.gz |
Issue #28858: Remove _PyObject_CallArg1() macro
Replace
_PyObject_CallArg1(func, arg)
with
PyObject_CallFunctionObjArgs(func, arg, NULL)
Using the _PyObject_CallArg1() macro increases the usage of the C stack, which
was unexpected and unwanted. PyObject_CallFunctionObjArgs() doesn't have this
issue.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_asynciomodule.c | 6 | ||||
-rw-r--r-- | Modules/_collectionsmodule.c | 3 | ||||
-rw-r--r-- | Modules/_elementtree.c | 11 | ||||
-rw-r--r-- | Modules/_pickle.c | 2 | ||||
-rw-r--r-- | Modules/_sre.c | 2 | ||||
-rw-r--r-- | Modules/pyexpat.c | 2 |
6 files changed, 14 insertions, 12 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 4e8f74a3c9..ea02a5e9c0 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -257,7 +257,7 @@ future_get_result(FutureObj *fut, PyObject **result) return -1; } - exc = _PyObject_CallArg1(asyncio_InvalidStateError, msg); + exc = PyObject_CallFunctionObjArgs(asyncio_InvalidStateError, msg, NULL); Py_DECREF(msg); if (exc == NULL) { return -1; @@ -835,7 +835,7 @@ FutureObj_finalize(FutureObj *fut) func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler); if (func != NULL) { - res = _PyObject_CallArg1(func, context); + res = PyObject_CallFunctionObjArgs(func, context, NULL); if (res == NULL) { PyErr_WriteUnraisable(func); } @@ -1731,7 +1731,7 @@ TaskObj_finalize(TaskObj *task) func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler); if (func != NULL) { - res = _PyObject_CallArg1(func, context); + res = PyObject_CallFunctionObjArgs(func, context, NULL); if (res == NULL) { PyErr_WriteUnraisable(func); } diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index cbf5b50cc9..b8b7584282 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -538,7 +538,8 @@ deque_copy(PyObject *deque) return NULL; } if (old_deque->maxlen < 0) - return _PyObject_CallArg1((PyObject *)(Py_TYPE(deque)), deque); + return PyObject_CallFunctionObjArgs((PyObject *)(Py_TYPE(deque)), + deque, NULL); 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 3837ff125a..2e0cda7bcb 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_CallArg1(st->parseerror_obj, errmsg); + error = PyObject_CallFunctionObjArgs(st->parseerror_obj, errmsg, NULL); 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_CallArg1(self->handle_data, value); + res = PyObject_CallFunctionObjArgs(self->handle_data, value, NULL); 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_CallArg1(self->handle_data, data); + res = PyObject_CallFunctionObjArgs(self->handle_data, data, NULL); 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_CallArg1(self->handle_end, tag); + res = PyObject_CallFunctionObjArgs(self->handle_end, tag, NULL); Py_DECREF(tag); } } @@ -3090,7 +3090,8 @@ 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_CallArg1(self->handle_comment, comment); + res = PyObject_CallFunctionObjArgs(self->handle_comment, + comment, NULL); Py_XDECREF(res); Py_DECREF(comment); } diff --git a/Modules/_pickle.c b/Modules/_pickle.c index d6d5cca10f..78c206e814 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -346,7 +346,7 @@ _Pickle_FastCall(PyObject *func, PyObject *obj) { PyObject *result; - result = _PyObject_CallArg1(func, obj); + result = PyObject_CallFunctionObjArgs(func, obj, NULL); Py_DECREF(obj); return result; } diff --git a/Modules/_sre.c b/Modules/_sre.c index 6e14901101..438849483f 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -1157,7 +1157,7 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string, match = pattern_new_match(self, &state, 1); if (!match) goto error; - item = _PyObject_CallArg1(filter, match); + item = PyObject_CallFunctionObjArgs(filter, match, NULL); Py_DECREF(match); if (!item) goto error; diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 541eee7beb..ece4d160eb 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_CallArg1(ErrorObject, buffer); + err = PyObject_CallFunctionObjArgs(ErrorObject, buffer, NULL); Py_DECREF(buffer); if ( err != NULL && set_error_attr(err, "code", code) |