summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSuren Nihalani <SurenNihalani@users.noreply.github.com>2017-11-07 17:35:23 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2017-11-07 17:35:23 (GMT)
commitc62f0cb3b1f6f9ca4ce463b1c99b0543bdfa38d6 (patch)
tree4455d4c210b88adb94001cb96333e2d5fe62a1a2 /Lib/test
parentc060c7e3d1000f867f6c54f54ebbc49e0c6d6b38 (diff)
downloadcpython-c62f0cb3b1f6f9ca4ce463b1c99b0543bdfa38d6.zip
cpython-c62f0cb3b1f6f9ca4ce463b1c99b0543bdfa38d6.tar.gz
cpython-c62f0cb3b1f6f9ca4ce463b1c99b0543bdfa38d6.tar.bz2
bpo-31620: have asyncio/queues not leak memory when you've exceptions during waiting (#3813)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_asyncio/test_queues.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_queues.py b/Lib/test/test_asyncio/test_queues.py
index fe5a6db..2137cde 100644
--- a/Lib/test/test_asyncio/test_queues.py
+++ b/Lib/test/test_asyncio/test_queues.py
@@ -295,6 +295,23 @@ class QueueGetTests(_QueueTestBase):
loop=self.loop),
)
+ def test_cancelled_getters_not_being_held_in_self_getters(self):
+ def a_generator():
+ yield 0.1
+ yield 0.2
+
+ self.loop = self.new_test_loop(a_generator)
+ @asyncio.coroutine
+ def consumer(queue):
+ try:
+ item = yield from asyncio.wait_for(queue.get(), 0.1, loop=self.loop)
+ except asyncio.TimeoutError:
+ pass
+
+ queue = asyncio.Queue(loop=self.loop, maxsize=5)
+ self.loop.run_until_complete(self.loop.create_task(consumer(queue)))
+ self.assertEqual(len(queue._getters), 0)
+
class QueuePutTests(_QueueTestBase):