STINNER Victor added the comment:

I see two options to fix this issue:

- add an optional parameter to set_result() to do nothing if the future is 
cancelled
- add a method (public or private) to set a result or do nothing if the future 
is cancelled

Patch "Add ignore_cancelled and ignore_done to Future.set_result()" (for Tulip):
http://codereview.appspot.com/109340043

Patch "Add Future._maybe_set_result()":
http://codereview.appspot.com/108300043

I prefer the second patch because it doesn't touch the public API and it is 
shorter.

Note: the first patch contains unrelated changes, like checking fut.cancelled() 
instead of fut.done().

"_maybe_set_result()" is not a good name. Other suggestions: 
"_set_result_except_cancelled", ""_set_result_ignore_cancelled".

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21886>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to