Gustavo J. A. M. Carneiro added the comment:

> - Are there other places where a cancellation can have a similar effect? 
> Maybe the same logic in put()?

Hm.. I didn't look, but yes, it does look like it might be affected by the same 
issue.  I'll try to create a test for that to confirm.

> how can the yield-from in get() receive a CancelledError without the waiter 
> being cancelled?

Well, it definitely gets a CancelledError in the return (yield from waiter).  I 
added extensive logging and could confirm this is the case.

What happens is that

1. Test creates a task q.get()
2. The task coroutine, inside Queue.get, blocks on the yield from waiter
3. a couple of items are put in the queue
4. Test code calls task.cancel() (where `task` is running the coroutine q.get)
5. The Queue.get task receives a CancelledError because it was cancelled.  The 
exception appears to come from the `yield from waiter` only because this is the 
place where the Queue.get task was suspended, but waiter itself is not 
cancelled.

----------

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

Reply via email to