diff options
author | Steve Dower <steve.dower@python.org> | 2024-02-13 00:28:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-13 00:28:35 +0000 |
commit | ea25f32d5f7d9ae4358338a3fb49bba9b68051a5 (patch) | |
tree | cfc1ac858b799465b1354211b7d248277ee85b7b /Lib/test/_test_multiprocessing.py | |
parent | 2f0778675ad0eaf346924ef6a2f60529b92ffcfa (diff) | |
download | cpython-ea25f32d5f7d9ae4358338a3fb49bba9b68051a5.tar.gz cpython-ea25f32d5f7d9ae4358338a3fb49bba9b68051a5.zip |
gh-89240: Enable multiprocessing on Windows to use large process pools (GH-107873)
We add _winapi.BatchedWaitForMultipleObjects to wait for larger numbers of handles.
This is an internal module, hence undocumented, and should be used with caution.
Check the docstring for info before using BatchedWaitForMultipleObjects.
Diffstat (limited to 'Lib/test/_test_multiprocessing.py')
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index c0d3ca50f17..94ce85cac75 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -6113,6 +6113,24 @@ class MiscTestCase(unittest.TestCase): self.assertEqual(rc, 0) self.assertFalse(err, msg=err.decode('utf-8')) + def test_large_pool(self): + # + # gh-89240: Check that large pools are always okay + # + testfn = os_helper.TESTFN + self.addCleanup(os_helper.unlink, testfn) + with open(testfn, 'w', encoding='utf-8') as f: + f.write(textwrap.dedent('''\ + import multiprocessing + def f(x): return x*x + if __name__ == '__main__': + with multiprocessing.Pool(200) as p: + print(sum(p.map(f, range(1000)))) + ''')) + rc, out, err = script_helper.assert_python_ok(testfn) + self.assertEqual("332833500", out.decode('utf-8').strip()) + self.assertFalse(err, msg=err.decode('utf-8')) + # # Mixins |