summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/queues.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-11-07 19:08:15 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2017-11-07 19:08:15 (GMT)
commitac4f6d4448fb6f9affb817bafb8357450fe43349 (patch)
tree065069e8c29beb1b2ea6d6c626c505d9587da289 /Lib/asyncio/queues.py
parent64f10492dcda4117ac06399ae46ab645cb09b19e (diff)
downloadcpython-ac4f6d4448fb6f9affb817bafb8357450fe43349.zip
cpython-ac4f6d4448fb6f9affb817bafb8357450fe43349.tar.gz
cpython-ac4f6d4448fb6f9affb817bafb8357450fe43349.tar.bz2
bpo-31620: have asyncio/queues not leak memory when you've exceptions during waiting (GH-3813) (#4326)
(cherry picked from commit c62f0cb3b1f6f9ca4ce463b1c99b0543bdfa38d6)
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 2d38972..1c66d67 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.