@@ -265,7 +265,7 @@ Each worker's interpreter is isolated from all the other interpreters.
265
265
"Isolated" means each interpreter has its own runtime state and
266
266
operates completely independently. For example, if you redirect
267
267
:data: `sys.stdout ` in one interpreter, it will not be automatically
268
- redirected any other interpreter. If you import a module in one
268
+ redirected to any other interpreter. If you import a module in one
269
269
interpreter, it is not automatically imported in any other. You
270
270
would need to import the module separately in interpreter where
271
271
you need it. In fact, each module imported in an interpreter is
@@ -287,7 +287,7 @@ efficient alternative is to serialize with :mod:`pickle` and then send
287
287
the bytes over a shared :mod: `socket <socket> ` or
288
288
:func: `pipe <os.pipe> `.
289
289
290
- .. class :: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=(), shared=None )
290
+ .. class :: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
291
291
292
292
A :class: `ThreadPoolExecutor ` subclass that executes calls asynchronously
293
293
using a pool of at most *max_workers * threads. Each thread runs
@@ -304,32 +304,17 @@ the bytes over a shared :mod:`socket <socket>` or
304
304
and *initargs * using :mod: `pickle ` when sending them to the worker's
305
305
interpreter.
306
306
307
- .. note ::
308
- Functions defined in the ``__main__ `` module cannot be pickled
309
- and thus cannot be used.
310
-
311
307
.. note ::
312
308
The executor may replace uncaught exceptions from *initializer *
313
309
with :class: `~concurrent.futures.interpreter.ExecutionFailed `.
314
310
315
- The optional *shared * argument is a :class: `dict ` of objects that all
316
- interpreters in the pool share. The *shared * items are added to each
317
- interpreter's ``__main__ `` module. Not all objects are shareable.
318
- Shareable objects include the builtin singletons, :class: `str `
319
- and :class: `bytes `, and :class: `memoryview `. See :pep: `734 `
320
- for more info.
321
-
322
311
Other caveats from parent :class: `ThreadPoolExecutor ` apply here.
323
312
324
313
:meth: `~Executor.submit ` and :meth: `~Executor.map ` work like normal,
325
314
except the worker serializes the callable and arguments using
326
315
:mod: `pickle ` when sending them to its interpreter. The worker
327
316
likewise serializes the return value when sending it back.
328
317
329
- .. note ::
330
- Functions defined in the ``__main__ `` module cannot be pickled
331
- and thus cannot be used.
332
-
333
318
When a worker's current task raises an uncaught exception, the worker
334
319
always tries to preserve the exception as-is. If that is successful
335
320
then it also sets the ``__cause__ `` to a corresponding
0 commit comments