summaryrefslogtreecommitdiff
path: root/Lib/asyncio/queues.py
diff options
context:
space:
mode:
authorSuren Nihalani <SurenNihalani@users.noreply.github.com>2017-11-07 09:35:23 -0800
committerAndrew Svetlov <andrew.svetlov@gmail.com>2017-11-07 20:35:23 +0300
commitc62f0cb3b1f6f9ca4ce463b1c99b0543bdfa38d6 (patch)
tree4455d4c210b88adb94001cb96333e2d5fe62a1a2 /Lib/asyncio/queues.py
parentc060c7e3d1000f867f6c54f54ebbc49e0c6d6b38 (diff)
downloadcpython-git-c62f0cb3b1f6f9ca4ce463b1c99b0543bdfa38d6.tar.gz
bpo-31620: have asyncio/queues not leak memory when you've exceptions during waiting (#3813)
Diffstat (limited to 'Lib/asyncio/queues.py')
-rw-r--r--Lib/asyncio/queues.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/asyncio/queues.py b/Lib/asyncio/queues.py
index 2d38972c0d..1c66d67b04 100644
--- a/Lib/asyncio/queues.py
+++ b/Lib/asyncio/queues.py
@@ -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.