classification
Title: asyncio: document behaviour of wait() cancellation
Type: Stage: resolved
Components: asyncio Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: chris.jerdonek, gvanrossum, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2015-04-03 15:13 by vstinner, last changed 2018-07-11 21:46 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7217 merged Elvis.Pranskevichus, 2018-05-29 20:03
PR 7227 merged miss-islington, 2018-05-29 22:22
PR 7228 closed miss-islington, 2018-05-29 22:23
PR 7230 merged Elvis.Pranskevichus, 2018-05-29 22:52
Messages (5)
msg240001 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-04-03 15:13
When wait(fs) is cancelled, futures of fs are not cancelled. This behaviour is not documented. It should be documented, and a warning should be added to the Cancellation section:
https://docs.python.org/dev/library/asyncio-dev.html#cancellation

See my message "Cancellation of asyncio.wait()":
https://mail.google.com/mail/u/0/#label/Tulip/14b34f0a5d31114f
msg318124 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-05-29 22:21
New changeset f9aeca2085464838f04bf13f816a1f861d43541f by Yury Selivanov (Elvis Pranskevichus) in branch 'master':
bpo-23859: Document that asyncio.wait() does not cancel its futures (#7217)
https://github.com/python/cpython/commit/f9aeca2085464838f04bf13f816a1f861d43541f
msg318136 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-29 22:48
> https://github.com/python/cpython/commit/f9aeca2085464838f04bf13f816a1f861d43541f

" +   when a timeout accurs. "

typo: accurs => occurs
msg318145 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-05-30 01:26
New changeset f95269404c03bd769a3551cd851b51b8f89672df by Yury Selivanov (Miss Islington (bot)) in branch '3.7':
[3.7] bpo-23859: Document that asyncio.wait() does not cancel its futures (GH-7217) (#7227)
https://github.com/python/cpython/commit/f95269404c03bd769a3551cd851b51b8f89672df
msg318161 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-30 10:06
Thank you Elvis for the documentation! Cancellation is one of the most complex part of asynchronous programming, and I don't think that asyncio documentation explains it properly. We may document the behaviour on cancellation for most task functions.

https://docs.python.org/dev/library/asyncio-task.html#task-functions

as_completed() behaviour on cancellation is not documented for example.

The wait() documentation should be backported to 3.6 as well.
History
Date User Action Args
2018-07-11 21:46:40vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-05-30 10:06:20vstinnersetmessages: + msg318161
versions: + Python 3.7, Python 3.8, - Python 3.4, Python 3.5
2018-05-30 01:26:24yselivanovsetmessages: + msg318145
2018-05-29 22:52:37Elvis.Pranskevichussetpull_requests: + pull_request6862
2018-05-29 22:48:21vstinnersetmessages: + msg318136
2018-05-29 22:23:54miss-islingtonsetpull_requests: + pull_request6860
2018-05-29 22:22:56miss-islingtonsetpull_requests: + pull_request6859
2018-05-29 22:21:54yselivanovsetmessages: + msg318124
2018-05-29 20:03:51Elvis.Pranskevichussetkeywords: + patch
stage: patch review
pull_requests: + pull_request6850
2017-12-31 05:09:04chris.jerdoneksetversions: + Python 3.6
2017-12-31 05:07:55chris.jerdoneksetnosy: + chris.jerdonek
2015-04-03 15:13:17vstinnercreate