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

2022-02-22 Thread Andrew Svetlov
Andrew Svetlov added the comment: Sorry, that's how asyncio works: it never switches to another task if `await ...` doesn't need to wait for something actually. Adding `await asyncio.sleep(0)` to every call decreases performance. -- resolution: -> wont fix stage: patch review -> res

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

2021-02-05 Thread Spencer Nelson
Spencer Nelson added the comment: Josh, > Making literally every await equivalent to: > > await asyncio.sleep(0) > > followed by the actual await (which is effectively what you're proposing when > you expect all await to be preemptible) means adding non-trivial overhead to > all async oper

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

2021-02-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Making literally every await equivalent to: await asyncio.sleep(0) followed by the actual await (which is effectively what you're proposing when you expect all await to be preemptible) means adding non-trivial overhead to all async operations (asyncio is ba

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

2021-02-04 Thread Spencer Nelson
Spencer Nelson 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 p

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

2021-02-04 Thread Ken Jin
Ken Jin 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)``

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

2021-02-03 Thread Spencer Nelson
Change by Spencer Nelson : -- keywords: +patch pull_requests: +23243 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24433 ___ Python tracker ___ _

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

2021-02-03 Thread Spencer Nelson
New submission from Spencer Nelson : I am writing some software that reads records from a very large file (~hundreds of GB), putting them in an `asyncio.Queue` as it goes, and a chain of consumers handle each record and do stuff over the network. To my surprise, my program runs out of memory