[issue32363] Deprecate task.set_result() and task.set_exception()

Chris Jerdonek report at bugs.python.org
Tue Feb 19 14:08:53 EST 2019


Chris Jerdonek <chris.jerdonek at gmail.com> added the comment:

> Use Task.cancel() or use a Queue to communicate with the task.

One reason why Task.cancel() is an incomplete replacement for Task.set_exception() is that you don't have an easy way to communicate why the task was ended.

With set_exception() and set_result(), you could. Task.cancel(), though, doesn't let you e.g. specify a CancelledError subclass or "reason" string (see the related bpo-35674, "Add argument to .cancel() of Task and Future").

----------
nosy: +chris.jerdonek

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


More information about the Python-bugs-list mailing list