[issue32104] add method throw() to asyncio.Task

2018-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: I'm just going to close this as "won't fix". -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker ___

[issue32104] add method throw() to asyncio.Task

2017-12-13 Thread Andrew Svetlov
Andrew Svetlov added the comment: I think the ship has sailed. Now too many code is based on assumption that the only way to cancel a task from outer code is `task.cancel()`. Internally it is turned into try: await do_stuff() except asyncio.CancelledError:

[issue32104] add method throw() to asyncio.Task

2017-11-30 Thread Oleg K
Oleg K added the comment: What is an "advanced" task? Why CancelledError is not enough? What's the actual use case? -- for instance, i want to create a task which is responsible for controlling a "slow resource" that should accessed carefully not

[issue32104] add method throw() to asyncio.Task

2017-11-21 Thread Yury Selivanov
Yury Selivanov added the comment: > in order to write advanced Tasks there should be a way > to throw custom exceptions into active Task. > so it can react accordingly. What is an "advanced" task? Why CancelledError is not enough? What's the actual use case?

[issue32104] add method throw() to asyncio.Task

2017-11-21 Thread Oleg K
New submission from Oleg K : currently there is no other way to interrupt task but to call cancel() which will: "This arranges for a CancelledError to be thrown into the wrapped coroutine on the next cycle through the event loop." in order to write advanced Tasks there