Skip to content

asyncio.Task: rename internal nested variable to don't hide another declaration from outer scope #32181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2707,22 +2707,22 @@ task_step_impl(TaskObj *task, PyObject *exc)
/* The error is StopIteration and that means that
the underlying coroutine has resolved */

PyObject *res;
PyObject *tmp;
if (task->task_must_cancel) {
// Task is cancelled right before coro stops.
task->task_must_cancel = 0;
res = future_cancel((FutureObj*)task, task->task_cancel_msg);
tmp = future_cancel((FutureObj*)task, task->task_cancel_msg);
}
else {
res = future_set_result((FutureObj*)task, result);
tmp = future_set_result((FutureObj*)task, result);
}

Py_DECREF(result);

if (res == NULL) {
if (tmp == NULL) {
return NULL;
}
Py_DECREF(res);
Py_DECREF(tmp);
Py_RETURN_NONE;
}

Expand Down Expand Up @@ -2786,7 +2786,7 @@ task_step_impl(TaskObj *task, PyObject *exc)
/* Check if `result` is FutureObj or TaskObj (and not a subclass) */
if (Future_CheckExact(result) || Task_CheckExact(result)) {
PyObject *wrapper;
PyObject *res;
PyObject *tmp;
FutureObj *fut = (FutureObj*)result;

/* Check if `result` future is attached to a different loop */
Expand All @@ -2805,13 +2805,13 @@ task_step_impl(TaskObj *task, PyObject *exc)
if (wrapper == NULL) {
goto fail;
}
res = future_add_done_callback(
tmp = future_add_done_callback(
(FutureObj*)result, wrapper, task->task_context);
Py_DECREF(wrapper);
if (res == NULL) {
if (tmp == NULL) {
goto fail;
}
Py_DECREF(res);
Py_DECREF(tmp);

/* task._fut_waiter = result */
task->task_fut_waiter = result; /* no incref is necessary */
Expand Down Expand Up @@ -2853,7 +2853,7 @@ task_step_impl(TaskObj *task, PyObject *exc)
if (o != NULL && o != Py_None) {
/* `result` is a Future-compatible object */
PyObject *wrapper;
PyObject *res;
PyObject *tmp;

int blocking = PyObject_IsTrue(o);
Py_DECREF(o);
Expand Down Expand Up @@ -2897,13 +2897,13 @@ task_step_impl(TaskObj *task, PyObject *exc)
PyObject *stack[2];
stack[0] = wrapper;
stack[1] = (PyObject *)task->task_context;
res = PyObject_Vectorcall(add_cb, stack, 1, context_kwname);
tmp = PyObject_Vectorcall(add_cb, stack, 1, context_kwname);
Py_DECREF(add_cb);
Py_DECREF(wrapper);
if (res == NULL) {
if (tmp == NULL) {
goto fail;
}
Py_DECREF(res);
Py_DECREF(tmp);

/* task._fut_waiter = result */
task->task_fut_waiter = result; /* no incref is necessary */
Expand Down