Skip to content

Conversation

@aisk
Copy link
Contributor

@aisk aisk commented Jul 3, 2024

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Comment on lines 1263 to 1265
The *executor* argument should be an :class:`concurrent.futures.Executor`
instance. The default executor is used if *executor* is ``None``.
The *executor* argument should be a :class:`concurrent.futures.Executor`
instance. The default executor :class:`concurrent.futures.ThreadPoolExecutor`
is used if not set by :meth:`loop.set_default_executor`.
Copy link
Member

Choose a reason for hiding this comment

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

Sorry to butt in, but this is still pretty imprecise. First the executor argument may also be None. Second, the default executor is not just any ThreadPoolExecutor, it is the default executor of the event loop (loop), which is always a ThreadPoolExecutor. This may indeed be set using set_default_executor, otherwise it is "lazy-initialized" by run_in_executor if needed.

Copy link
Contributor Author

@aisk aisk Jul 4, 2024

Choose a reason for hiding this comment

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

Thanks for the review, how about this, regardless the format:

The *executor* argument should be a :class:`concurrent.futures.Executor`
instance. The default executor of the event loop is used if *executor* is ``None``.
The default executor can be set by :meth:`loop.set_default_executor`, otherwise, 
a :class:`concurrent.futures.ThreadPoolExecutor` will be lazy-initialized by
 :func:`run_in_executor` if needed.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Perfect!

@kumaraditya303 kumaraditya303 merged commit facf986 into python:main Jul 9, 2024
@kumaraditya303 kumaraditya303 added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Jul 9, 2024
@miss-islington-app
Copy link

Thanks @aisk for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @aisk for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 9, 2024
…_in_executor (pythonGH-121335)

(cherry picked from commit facf986)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 9, 2024
…_in_executor (pythonGH-121335)

(cherry picked from commit facf986)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Jul 9, 2024

GH-121525 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Jul 9, 2024
@bedevere-app
Copy link

bedevere-app bot commented Jul 9, 2024

GH-121526 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jul 9, 2024
kumaraditya303 added a commit that referenced this pull request Jul 9, 2024
…n_in_executor (GH-121335) (#121525)

gh-121333: Clarify what is the default executor for asyncio.run_in_executor (GH-121335)
(cherry picked from commit facf986)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
kumaraditya303 added a commit that referenced this pull request Jul 9, 2024
…n_in_executor (GH-121335) (#121526)

gh-121333: Clarify what is the default executor for asyncio.run_in_executor (GH-121335)
(cherry picked from commit facf986)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@aisk aisk deleted the default-executor-doc branch July 9, 2024 17:21
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
…_in_executor (python#121335)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
…_in_executor (python#121335)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants