mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-30966: Add multiprocessing.SimpleQueue.close() (GH-19735)
Add a new close() method to multiprocessing.SimpleQueue to explicitly close the queue. Automerge-Triggered-By: @pitrou
This commit is contained in:
parent
c5c42815ec
commit
9adccc1384
5 changed files with 38 additions and 0 deletions
|
@ -5244,6 +5244,20 @@ class TestSimpleQueue(unittest.TestCase):
|
|||
|
||||
proc.join()
|
||||
|
||||
def test_close(self):
|
||||
queue = multiprocessing.SimpleQueue()
|
||||
queue.close()
|
||||
# closing a queue twice should not fail
|
||||
queue.close()
|
||||
|
||||
# Test specific to CPython since it tests private attributes
|
||||
@test.support.cpython_only
|
||||
def test_closed(self):
|
||||
queue = multiprocessing.SimpleQueue()
|
||||
queue.close()
|
||||
self.assertTrue(queue._reader.closed)
|
||||
self.assertTrue(queue._writer.closed)
|
||||
|
||||
|
||||
class TestPoolNotLeakOnFailure(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue