[New-bugs-announce] [issue32104] add method throw() to asyncio.Task

Oleg K report at bugs.python.org
Tue Nov 21 09:44:12 EST 2017


New submission from Oleg K <windspirit at gmail.com>:

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 should be a way
to throw custom exceptions into active Task. 
so it can react accordingly.  

i am looking for the same thing as "generator.throw()" is providing,
allowing to interrupt generators different way.

----------
components: asyncio
messages: 306644
nosy: Oleg K2, yselivanov
priority: normal
severity: normal
status: open
title: add method throw() to asyncio.Task
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32104>
_______________________________________


More information about the New-bugs-announce mailing list