diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-12-01 13:43:22 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-12-01 13:43:22 (GMT) |
commit | 27580c1fb5e8cb756304f523006d832d2e3532e7 (patch) | |
tree | f25f5c8e7a05f3d3d4049050459fecd7e81a5b46 /Modules/_asynciomodule.c | |
parent | 8be1c39eb3416e9d85c7e3ccd4794969588c8030 (diff) | |
download | cpython-27580c1fb5e8cb756304f523006d832d2e3532e7.zip cpython-27580c1fb5e8cb756304f523006d832d2e3532e7.tar.gz cpython-27580c1fb5e8cb756304f523006d832d2e3532e7.tar.bz2 |
Replace PyObject_CallFunctionObjArgs() with fastcall
* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func)
* PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg)
PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires
extra work to "parse" C arguments to build a C array of PyObject*.
_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.
This change is part of the fastcall project. The change on listsort() is
related to the issue #23507.
Diffstat (limited to 'Modules/_asynciomodule.c')
-rw-r--r-- | Modules/_asynciomodule.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index b65fc02..19503a8 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -721,8 +721,7 @@ static PyObject * _asyncio_Future__repr_info_impl(FutureObj *self) /*[clinic end generated code: output=fa69e901bd176cfb input=f21504d8e2ae1ca2]*/ { - return PyObject_CallFunctionObjArgs( - asyncio_future_repr_info_func, self, NULL); + return _PyObject_CallArg1(asyncio_future_repr_info_func, self); } /*[clinic input] @@ -1535,8 +1534,7 @@ static PyObject * _asyncio_Task__repr_info_impl(TaskObj *self) /*[clinic end generated code: output=6a490eb66d5ba34b input=3c6d051ed3ddec8b]*/ { - return PyObject_CallFunctionObjArgs( - asyncio_task_repr_info_func, self, NULL); + return _PyObject_CallArg1(asyncio_task_repr_info_func, self); } /*[clinic input] @@ -1896,7 +1894,7 @@ task_set_error_soon(TaskObj *task, PyObject *et, const char *format, ...) return NULL; } - PyObject *e = PyObject_CallFunctionObjArgs(et, msg, NULL); + PyObject *e = _PyObject_CallArg1(et, msg); Py_DECREF(msg); if (e == NULL) { return NULL; @@ -1946,7 +1944,7 @@ task_step_impl(TaskObj *task, PyObject *exc) if (!exc) { /* exc was not a CancelledError */ - exc = PyObject_CallFunctionObjArgs(asyncio_CancelledError, NULL); + exc = _PyObject_CallNoArg(asyncio_CancelledError); if (!exc) { goto fail; } @@ -2176,7 +2174,7 @@ task_step_impl(TaskObj *task, PyObject *exc) } /* Check if `result` is a generator */ - o = PyObject_CallFunctionObjArgs(inspect_isgenerator, result, NULL); + o = _PyObject_CallArg1(inspect_isgenerator, result); if (o == NULL) { /* An exception in inspect.isgenerator */ goto fail; |