Message291522
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. |
|
Date |
User |
Action |
Args |
2017-04-12 00:11:24 | abacabadabacaba | set | recipients:
+ abacabadabacaba, yselivanov |
2017-04-12 00:11:24 | abacabadabacaba | set | messageid: <1491955884.31.0.0746508313156.issue30048@psf.upfronthosting.co.za> |
2017-04-12 00:11:24 | abacabadabacaba | link | issue30048 messages |
2017-04-12 00:11:23 | abacabadabacaba | create | |
|