From 3f6ef1e99f7c517a21d4f53c63b0aeef7e5b5b2c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 1 Dec 2016 14:51:04 +0100 Subject: Replace PyObject_CallFunction() with fastcall Replace PyObject_CallFunction(func, "O", arg) and PyObject_CallFunction(func, "O", arg, NULL) with _PyObject_CallArg1(func, arg) Replace PyObject_CallFunction(func, NULL) with _PyObject_CallNoArg(func) _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack. --- Modules/_collectionsmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Modules/_collectionsmodule.c') diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 6608798247..cbf5b50cc9 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); -- cgit v1.2.1 From 40273ec4f37c65c13a09d0ac23b08c99ebe2f1a3 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 5 Dec 2016 17:04:32 +0100 Subject: 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. --- Modules/_collectionsmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Modules/_collectionsmodule.c') 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); -- cgit v1.2.1 From b56eb89251a68eee7398838e86bc0a0b684d7b3f Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Thu, 12 Jan 2017 22:25:25 -0800 Subject: Fix typo --- Modules/_collectionsmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Modules/_collectionsmodule.c') diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index b8b7584282..e8131ad6a0 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -2235,7 +2235,7 @@ static PyTypeObject defdict_type = { PyDoc_STRVAR(_count_elements_doc, "_count_elements(mapping, iterable) -> None\n\ \n\ -Count elements in the iterable, updating the mappping"); +Count elements in the iterable, updating the mapping"); static PyObject * _count_elements(PyObject *self, PyObject *args) -- cgit v1.2.1