[issue43119] asyncio.Queue.put never yields if the queue is unbounded

Spencer Nelson report at bugs.python.org
Thu Feb 4 12:49:27 EST 2021


Spencer Nelson <swnelson at uw.edu> added the comment:

Thanks for testing on more Python versions.

Yes, adding asyncio.sleep(0) after each put is an effective workaround - it's certainly possible to manually yield like that. I just think that that's what asyncio.Queue.put ought to be doing - in fact, that's my proposed change in the associated PR: https://github.com/python/cpython/pull/24433/files#diff-22a6bcb03e783378149a3e9411c185b13c908e61886ffd55145634b7ab12caacR141

I suppose that, more broadly, I would have expected that _any_ `await f()` call would be a preemptible point, but I think that's a much, much larger discussion.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43119>
_______________________________________


More information about the Python-bugs-list mailing list