diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2016-12-10 16:16:17 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2016-12-10 16:16:17 (GMT) |
commit | ebb39bcc048b33d529a64f517ccee1c172ff8b07 (patch) | |
tree | e9c5c42ccd7271e9d67506797417b06066d90f2a /Lib/test/_test_multiprocessing.py | |
parent | 13f1c331a5dd5b4ff3b1e4c9e47d6d3ae75e0f8f (diff) | |
parent | cd2a201e5bb33c9b44401a91e10189be87885efe (diff) | |
download | cpython-ebb39bcc048b33d529a64f517ccee1c172ff8b07.zip cpython-ebb39bcc048b33d529a64f517ccee1c172ff8b07.tar.gz cpython-ebb39bcc048b33d529a64f517ccee1c172ff8b07.tar.bz2 |
Issue #28779: multiprocessing.set_forkserver_preload() would crash the forkserver process if a preloaded module instantiated some multiprocessing objects such as locks.
Diffstat (limited to 'Lib/test/_test_multiprocessing.py')
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index c00846c..b5f4782 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -3818,6 +3818,19 @@ class TestStartMethod(unittest.TestCase): self.assertTrue(methods == ['fork', 'spawn'] or methods == ['fork', 'spawn', 'forkserver']) + def test_preload_resources(self): + if multiprocessing.get_start_method() != 'forkserver': + self.skipTest("test only relevant for 'forkserver' method") + name = os.path.join(os.path.dirname(__file__), 'mp_preload.py') + rc, out, err = test.support.script_helper.assert_python_ok(name) + out = out.decode() + err = err.decode() + if out.rstrip() != 'ok' or err != '': + print(out) + print(err) + self.fail("failed spawning forkserver or grandchild") + + # # Check that killing process does not leak named semaphores # |