@@ -130,7 +130,7 @@ Executor Objects
130130 e.submit(shutil.copy, 'src4.txt', 'dest4.txt')
131131
132132 .. versionchanged :: 3.9
133- Added *cancel_futures *.
133+ Added the *cancel_futures * parameter .
134134
135135
136136ThreadPoolExecutor
@@ -172,7 +172,8 @@ And::
172172 # the single worker thread is already waiting for wait_on_future().
173173
174174
175- .. class :: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
175+ .. class :: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', \
176+ initializer=None, initargs=(), **ctxkwargs)
176177
177178 An :class: `Executor ` subclass that uses a pool of at most *max_workers *
178179 threads to execute calls asynchronously.
@@ -190,6 +191,18 @@ And::
190191 pending jobs will raise a :exc: `~concurrent.futures.thread.BrokenThreadPool `,
191192 as well as any attempt to submit more jobs to the pool.
192193
194+ *ctxkwargs * is a mapping of additional keyword arguments passed to
195+ :meth: `prepare_context `, allowing customization of the worker execution
196+ context.
197+
198+ .. classmethod :: prepare_context(initializer, initargs)
199+
200+ Setting up the necessary context for creating worker instances in a
201+ pool-based executor (for example, in a concurrent environment like
202+ threads or interpreters).
203+
204+ .. versionadded :: 3.14
205+
193206 .. versionchanged :: 3.5
194207 If *max_workers * is ``None `` or
195208 not given, it will default to the number of processors on the machine,
@@ -219,6 +232,10 @@ And::
219232 Default value of *max_workers * is changed to
220233 ``min(32, (os.process_cpu_count() or 1) + 4) ``.
221234
235+ .. versionchanged :: 3.14
236+ Added *ctxkwargs * to pass additional arguments to :meth: `prepare_context `
237+ class method.
238+
222239
223240.. _threadpoolexecutor-example :
224241
@@ -307,7 +324,8 @@ efficient alternative is to serialize with :mod:`pickle` and then send
307324the bytes over a shared :mod: `socket <socket> ` or
308325:func: `pipe <os.pipe> `.
309326
310- .. class :: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
327+ .. class :: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', \
328+ initializer=None, initargs=())
311329
312330 A :class: `ThreadPoolExecutor ` subclass that executes calls asynchronously
313331 using a pool of at most *max_workers * threads. Each thread runs
@@ -367,7 +385,9 @@ per :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit`
367385and :meth: `~Executor.map ` on a :class: `ProcessPoolExecutor `. A function defined
368386in a REPL or a lambda should not be expected to work.
369387
370- .. class :: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_child=None)
388+ .. class :: ProcessPoolExecutor(max_workers=None, mp_context=None, \
389+ initializer=None, initargs=(), \
390+ max_tasks_per_child=None)
371391
372392 An :class: `Executor ` subclass that executes calls asynchronously using a pool
373393 of at most *max_workers * processes. If *max_workers * is ``None `` or not
0 commit comments