Message323911
As far as I know, there is no mechanism for aborting a created coroutine instance before it's executed with an await (directly or indirectly). I have a function which takes in coroutine instances and conditionally creates a task for them that I track so that they can be later gathered. When the condition is false, I'd like to not execute the passed in coroutine.
Simply ignoring the coroutine works but reports a RuntimeWarning about coroutine not being awaited on. Checking the conditional before calling the function works but damages maintainability and is putting the responsibility on the wrong party.
Creating the task then immediately cancelling it does not work since execution for it will start and leads to other cancellation issues.
Is there a way to abort a coroutine instance that I'm not aware of? |
|
Date |
User |
Action |
Args |
2018-08-22 22:02:43 | Sheng Zhong | set | recipients:
+ Sheng Zhong, asvetlov, yselivanov |
2018-08-22 22:02:43 | Sheng Zhong | set | messageid: <1534975363.12.0.56676864532.issue34467@psf.upfronthosting.co.za> |
2018-08-22 22:02:43 | Sheng Zhong | link | issue34467 messages |
2018-08-22 22:02:42 | Sheng Zhong | create | |
|