Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-124694: Document missing ctxkwargs argument in ThreadPoolExecutor#134321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
donBarbos wants to merge4 commits intopython:main
base:main
Choose a base branch
Loading
fromdonBarbos:issue-124694-docs
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletionsDoc/library/concurrent.futures.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,7 +114,7 @@ Executor Objects
e.submit(shutil.copy, 'src4.txt', 'dest4.txt')

.. versionchanged:: 3.9
Added *cancel_futures*.
Addedthe*cancel_futures* parameter.


ThreadPoolExecutor
Expand DownExpand Up@@ -154,7 +154,8 @@ And::
executor.submit(wait_on_future)


.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', \
initializer=None, initargs=(), **ctxkwargs)

An :class:`Executor` subclass that uses a pool of at most *max_workers*
threads to execute calls asynchronously.
Expand DownExpand Up@@ -201,6 +202,15 @@ And::
Default value of *max_workers* is changed to
``min(32, (os.process_cpu_count() or 1) + 4)``.

.. versionchanged:: 3.14
Added *ctxkwargs* to pass additional arguments to ``cls.prepare_context``
class method.

.. classmethod:: prepare_context(initializer, initargs)
Setting up the necessary context for creating worker instances in a pool-based executor (e.g., in a concurrent environment like threads or interpreters).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
Setting up the necessary context for creating worker instances in a pool-based executor (e.g., in a concurrent environment like threads or interpreters).
Setting up the necessary context for creating worker instances in a pool-based executor (for example, in a concurrent environment like threads or interpreters).

Use simple language and this line needs wrapping


.. versionadded:: 3.14


.. _threadpoolexecutor-example:

Expand DownExpand Up@@ -287,7 +297,8 @@ efficient alternative is to serialize with :mod:`pickle` and then send
the bytes over a shared :mod:`socket <socket>` or
:func:`pipe <os.pipe>`.

.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=(), shared=None)
.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is unrelated, but it's probably an improvement as it's now more readable. So I'm ok with it.

donBarbos reacted with thumbs up emoji
initializer=None, initargs=(), shared=None)

A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously
using a pool of at most *max_workers* threads. Each thread runs
Expand DownExpand Up@@ -357,7 +368,9 @@ that :class:`ProcessPoolExecutor` will not work in the interactive interpreter.
Calling :class:`Executor` or :class:`Future` methods from a callable submitted
to a :class:`ProcessPoolExecutor` will result in deadlock.

.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_child=None)
.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, \
initializer=None, initargs=(), \
max_tasks_per_child=None)

An :class:`Executor` subclass that executes calls asynchronously using a pool
of at most *max_workers* processes. If *max_workers* is ``None`` or not
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp