Explain an assert when waiting on a asyncio stream drain
If a task is waiting on a stream to drain and another task tries to this assertion will fail. It wasn't clear at first glance why the assertion failed, but I hope with this message it will be.
This commit is contained in:
parent
c49016e67c
commit
8823ed8b88
|
@ -191,7 +191,9 @@ class FlowControlMixin(protocols.Protocol):
|
|||
if not self._paused:
|
||||
return
|
||||
waiter = self._drain_waiter
|
||||
assert waiter is None or waiter.cancelled()
|
||||
assert waiter is None or waiter.cancelled(), (
|
||||
'Another task is waiting for this stream to drain'
|
||||
)
|
||||
waiter = self._loop.create_future()
|
||||
self._drain_waiter = waiter
|
||||
await waiter
|
||||
|
|
Loading…
Reference in New Issue