mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
bpo-31620: have asyncio/queues not leak memory when you've exceptions during waiting (#3813)
This commit is contained in:
parent
c060c7e3d1
commit
c62f0cb3b1
3 changed files with 25 additions and 0 deletions
|
@ -167,6 +167,12 @@ class Queue:
|
|||
yield from getter
|
||||
except:
|
||||
getter.cancel() # Just in case getter is not done yet.
|
||||
|
||||
try:
|
||||
self._getters.remove(getter)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if not self.empty() and not getter.cancelled():
|
||||
# We were woken up by put_nowait(), but can't take
|
||||
# the call. Wake up the next in line.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue