diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-12-15 08:05:11 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-12-15 08:05:11 (GMT) |
commit | cb2128cada922741381bcb6ee73a33842a9a43db (patch) | |
tree | 2bb8be4f82d94b81d5e590c81115df7414578be8 /Modules | |
parent | 0bf590627b14b9ffab4a24c49a8e21b7ff49886d (diff) | |
download | cpython-cb2128cada922741381bcb6ee73a33842a9a43db.zip cpython-cb2128cada922741381bcb6ee73a33842a9a43db.tar.gz cpython-cb2128cada922741381bcb6ee73a33842a9a43db.tar.bz2 |
_asyncio uses _PyObject_CallMethodIdObjArgs()
Issue #28920: Replace _PyObject_CallMethodId(obj, meth, "O", arg) with
_PyObject_CallMethodIdObjArgs(obj, meth, arg, NULL) to avoid
_PyObject_CallMethodId() special case when arg is a tuple.
If arg is a tuple, _PyObject_CallMethodId() unpacks the tuple: obj.meth(*arg).
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_asynciomodule.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 4e8f74a..fff9046 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1327,7 +1327,7 @@ _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop) return -1; } - res = _PyObject_CallMethodId(all_tasks, &PyId_add, "O", self, NULL); + res = _PyObject_CallMethodIdObjArgs(all_tasks, &PyId_add, self, NULL); if (res == NULL) { return -1; } @@ -1838,8 +1838,8 @@ task_call_wakeup(TaskObj *task, PyObject *fut) } else { /* `task` is a subclass of Task */ - return _PyObject_CallMethodId( - (PyObject*)task, &PyId__wakeup, "O", fut, NULL); + return _PyObject_CallMethodIdObjArgs((PyObject*)task, &PyId__wakeup, + fut, NULL); } } @@ -1854,8 +1854,8 @@ task_call_step(TaskObj *task, PyObject *arg) if (arg == NULL) { arg = Py_None; } - return _PyObject_CallMethodId( - (PyObject*)task, &PyId__step, "O", arg, NULL); + return _PyObject_CallMethodIdObjArgs((PyObject*)task, &PyId__step, + arg, NULL); } } @@ -1869,8 +1869,8 @@ task_call_step_soon(TaskObj *task, PyObject *arg) return -1; } - handle = _PyObject_CallMethodId( - task->task_loop, &PyId_call_soon, "O", cb, NULL); + handle = _PyObject_CallMethodIdObjArgs(task->task_loop, &PyId_call_soon, + cb, NULL); Py_DECREF(cb); if (handle == NULL) { return -1; @@ -2135,8 +2135,9 @@ task_step_impl(TaskObj *task, PyObject *exc) if (wrapper == NULL) { goto fail; } - res = _PyObject_CallMethodId( - result, &PyId_add_done_callback, "O", wrapper, NULL); + res = _PyObject_CallMethodIdObjArgs(result, + &PyId_add_done_callback, + wrapper, NULL); Py_DECREF(wrapper); if (res == NULL) { goto fail; |