gh-107963: Fix set_forkserver_preload to check the type of given list (#107965)

gh-107963: Fix set_forkserver_preload to check the type of given list
This commit is contained in:
Dong-hee Na 2023-08-15 22:58:12 +09:00 committed by GitHub
parent d66bc9e8a7
commit 6515ec3d3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View file

@ -5369,6 +5369,14 @@ class TestStartMethod(unittest.TestCase):
self.assertRaises(ValueError, ctx.set_start_method, None)
self.check_context(ctx)
def test_context_check_module_types(self):
try:
ctx = multiprocessing.get_context('forkserver')
except ValueError:
raise unittest.SkipTest('forkserver should be available')
with self.assertRaisesRegex(TypeError, 'module_names must be a list of strings'):
ctx.set_forkserver_preload([1, 2, 3])
def test_set_get(self):
multiprocessing.set_forkserver_preload(PRELOAD)
count = 0