mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
gh-117531: Unblock getters after non-immediate queue shutdown (#117532)
(This is a small tweak of the original gh-104750 which added shutdown.)
This commit is contained in:
parent
dfcae4379f
commit
6bc0b33a91
3 changed files with 26 additions and 5 deletions
|
@ -636,6 +636,23 @@ class BaseQueueTestMixin(BlockingTestMixin):
|
|||
|
||||
self.assertEqual(results, [True]*len(thrds))
|
||||
|
||||
def test_shutdown_pending_get(self):
|
||||
def get():
|
||||
try:
|
||||
results.append(q.get())
|
||||
except Exception as e:
|
||||
results.append(e)
|
||||
|
||||
q = self.type2test()
|
||||
results = []
|
||||
get_thread = threading.Thread(target=get)
|
||||
get_thread.start()
|
||||
q.shutdown(immediate=False)
|
||||
get_thread.join(timeout=10.0)
|
||||
self.assertFalse(get_thread.is_alive())
|
||||
self.assertEqual(len(results), 1)
|
||||
self.assertIsInstance(results[0], self.queue.ShutDown)
|
||||
|
||||
|
||||
class QueueTest(BaseQueueTestMixin):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue