Skip to content

Commit a54dd0b

Browse files
committed
fix
1 parent 3fe87b7 commit a54dd0b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Lib/multiprocessing/forkserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _stop_unlocked(self):
6161

6262
def set_forkserver_preload(self, modules_names):
6363
'''Set list of module names to try to load in forkserver process.'''
64-
if not all(type(mod) is str for mod in module_names):
64+
if not all(type(mod) is str for mod in modules_names):
6565
raise TypeError('module_names must be a list of strings')
6666
self._preload_modules = modules_names
6767

Lib/test/_test_multiprocessing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5369,6 +5369,12 @@ def test_context(self):
53695369
self.assertRaises(ValueError, ctx.set_start_method, None)
53705370
self.check_context(ctx)
53715371

5372+
def test_context_check_module_types(self):
5373+
ctx = multiprocessing.get_context('forkserver')
5374+
self.assertRaisesRegex(TypeError,
5375+
ctx.set_forkserver_preload([1, 2, 3]),
5376+
'module_names must be a list of strings')
5377+
53725378
def test_set_get(self):
53735379
multiprocessing.set_forkserver_preload(PRELOAD)
53745380
count = 0

0 commit comments

Comments
 (0)