mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
gh-124694: Add concurrent.futures.InterpreterPoolExecutor (gh-124548)
This is an implementation of InterpreterPoolExecutor that builds on ThreadPoolExecutor. (Note that this is not tied to PEP 734, which is strictly about adding a new stdlib module.) Possible future improvements: * support passing a script for the initializer or to submit() * support passing (most) arbitrary functions without pickling * support passing closures * optionally exec functions against __main__ instead of the their original module
This commit is contained in:
parent
a38fef4439
commit
a5a7f5e16d
12 changed files with 828 additions and 40 deletions
|
@ -23,6 +23,7 @@ def make_dummy_object(_):
|
|||
|
||||
|
||||
class ExecutorTest:
|
||||
|
||||
# Executor.shutdown() and context manager usage is tested by
|
||||
# ExecutorShutdownTest.
|
||||
def test_submit(self):
|
||||
|
@ -52,7 +53,8 @@ class ExecutorTest:
|
|||
i = self.executor.map(divmod, [1, 1, 1, 1], [2, 3, 0, 5])
|
||||
self.assertEqual(i.__next__(), (0, 1))
|
||||
self.assertEqual(i.__next__(), (0, 1))
|
||||
self.assertRaises(ZeroDivisionError, i.__next__)
|
||||
with self.assertRaises(ZeroDivisionError):
|
||||
i.__next__()
|
||||
|
||||
@support.requires_resource('walltime')
|
||||
def test_map_timeout(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue