This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 asvetlov
收信人 ajoino, alex.gronholm, asvetlov, chris.jerdonek, gvanrossum, iritkatriel, jab, njs, tinchester, yselivanov
日期 2022-02-18.11:52:09
SpamBayes Score -1.0
Marked as misclassified
Message-id <1645185129.97.0.773827898036.issue46771@roundup.psfhosted.org>
In-reply-to
内容
Guido, the third case:

The third edge case is: explicit cancel() happened *after* the timeout (but still in the
same iteration)?

   timeout  current-iteration (calls .cancel() after timeout)  next-iteration
     |                            |                                 |
 >---+----------------------------+---------------------------------+----------> future

  a) timeout occurs, `call_later()`' callback is called, the task cancellation is scheduled 
  on the next loop iteration by `task.cancel()` call
  b) other activity (e.g. socket-ready event that processed after timers in asyncio)
  explicitly calls `.cancel()`. The second request is ignored, `.cancel()` returns `False`.
  c) On the next iteration, the task wakes up with CancelledError with a message that points
  on the timeout context manager. 

It means that the timeout is processed, explicit `.cancel()` call that happens *after*
timeout is ignored. The first event wins, as usual.
历史
日期 用户 动作 参数
2022-02-18 11:52:10asvetlov修改recipients: + asvetlov, gvanrossum, njs, jab, alex.gronholm, chris.jerdonek, yselivanov, tinchester, iritkatriel, ajoino
2022-02-18 11:52:09asvetlov修改messageid: <1645185129.97.0.773827898036.issue46771@roundup.psfhosted.org>
2022-02-18 11:52:09asvetlov链接issue46771 messages
2022-02-18 11:52:09asvetlov创建