Andrew Svetlov <andrew.svet...@gmail.com> added the comment:

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.

----------

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

Reply via email to