New submission from Evgeny Kapun: If I run this code:
import asyncio as a @a.coroutine def coro1(): yield from a.ensure_future(coro2()) print("Still here") yield from a.sleep(1) print("Still here 2") @a.coroutine def coro2(): yield from a.sleep(1) res = task.cancel() print("Canceled task:", res) loop = a.get_event_loop() task = a.ensure_future(coro1()) loop.run_until_complete(task) I expect the task to stop shortly after a call to cancel(). It should surely stop when I try to sleep(). But it doesn't. On my machine this prints: Canceled task: True Still here Still here 2 So, cancel() returns True, but the task doesn't seem to be canceled. ---------- components: asyncio messages: 291522 nosy: abacabadabacaba, yselivanov priority: normal severity: normal status: open title: If a task is canceled at the right moment, the cancellation is ignored type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30048> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com