Ken Jin <[email protected]> added the comment:
Thanks for the minimal reproducer. I've tested it on 3.9.0 and 3.10a4 and they
seem to exhibit the same behavior too.
Out of genuine curiosity (I don't mean to question if this *is* a bug, it seems
like a trap for users): why not place an ``await asyncio.sleep(0)`` after
``queue.put`` line to force a switch in the producer? Eg, from your example
code, instead of :
while True:
await q.put(i)
maybe this:
while True:
await q.put(i)
await asyncio.sleep(0)
With that workaround, your example starts printing each item and the consumer
tasks don't seem to get blocked.
----------
nosy: +kj
versions: +Python 3.10, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43119>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com