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.

Author asvetlov
Recipients ajoino, alex.gronholm, asvetlov, chris.jerdonek, gvanrossum, iritkatriel, jab, njs, tinchester, yselivanov
Date 2022-02-18.11:52:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645185129.97.0.773827898036.issue46771@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2022-02-18 11:52:10asvetlovsetrecipients: + asvetlov, gvanrossum, njs, jab, alex.gronholm, chris.jerdonek, yselivanov, tinchester, iritkatriel, ajoino
2022-02-18 11:52:09asvetlovsetmessageid: <1645185129.97.0.773827898036.issue46771@roundup.psfhosted.org>
2022-02-18 11:52:09asvetlovlinkissue46771 messages
2022-02-18 11:52:09asvetlovcreate