[3.11] gh-107963: Fix set_forkserver_preload to check the type of given list (GH-107965) (gh-107976)

gh-107963: Fix set_forkserver_preload to check the type of given list (GH-107965)
(cherry picked from commit 6515ec3d3d)


gh-107963: Fix set_forkserver_preload to check the type of given list

Co-authored-by: Dong-hee Na <donghee.na@python.org>
This commit is contained in:
Miss Islington (bot) 2023-08-15 07:53:25 -07:00 committed by GitHub
parent e2420c5cae
commit db4400b5b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View file

@ -5293,6 +5293,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