mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-22872: multiprocessing.Queue's put() and get() now raise ValueError if the queue is closed. (GH-9010)
Previously, put() and get() would raise AssertionError and OSError, respectively.
This commit is contained in:
parent
e385d0661e
commit
0461704060
4 changed files with 26 additions and 2 deletions
|
@ -1114,6 +1114,14 @@ class _TestQueue(BaseTestCase):
|
|||
# Assert that the serialization and the hook have been called correctly
|
||||
self.assertTrue(not_serializable_obj.reduce_was_called)
|
||||
self.assertTrue(not_serializable_obj.on_queue_feeder_error_was_called)
|
||||
|
||||
def test_closed_queue_put_get_exceptions(self):
|
||||
for q in multiprocessing.Queue(), multiprocessing.JoinableQueue():
|
||||
q.close()
|
||||
with self.assertRaisesRegex(ValueError, 'is closed'):
|
||||
q.put('foo')
|
||||
with self.assertRaisesRegex(ValueError, 'is closed'):
|
||||
q.get()
|
||||
#
|
||||
#
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue