Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8a6045

Browse files
committed
Issue #26796: Don't configure the number of workers for default threadpool executor.
Initial patch by Hans Lawrenz.
1 parent 9f91e85 commit e8a6045

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

Doc/library/asyncio-eventloop.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,13 @@ pool of processes). By default, an event loop uses a thread pool executor
670670

671671
This method is a :ref:`coroutine <coroutine>`.
672672

673+
.. versionchanged:: 3.5.3
674+
:meth:`BaseEventLoop.run_in_executor` no longer configures the
675+
``max_workers`` of the thread pool executor it creates, instead
676+
leaving it up to the thread pool executor
677+
(:class:`~concurrent.futures.ThreadPoolExecutor`) to set the
678+
default.
679+
673680
.. method:: AbstractEventLoop.set_default_executor(executor)
674681

675682
Set the default executor used by :meth:`run_in_executor`.

Lib/asyncio/base_events.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
__all__ = ['BaseEventLoop']
4242

4343

44-
# Argument for default thread pool executor creation.
45-
_MAX_WORKERS = 5
46-
4744
# Minimum number of _scheduled timer handles before cleanup of
4845
# cancelled handles is performed.
4946
_MIN_SCHEDULED_TIMER_HANDLES = 100
@@ -616,7 +613,7 @@ def run_in_executor(self, executor, func, *args):
616613
if executor is None:
617614
executor = self._default_executor
618615
if executor is None:
619-
executor = concurrent.futures.ThreadPoolExecutor(_MAX_WORKERS)
616+
executor = concurrent.futures.ThreadPoolExecutor()
620617
self._default_executor = executor
621618
return futures.wrap_future(executor.submit(func, *args), loop=self)
622619

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,10 @@ Library
402402
children are done.
403403
Patch by Johannes Ebke.
404404

405+
- Issue #26796: Don't configure the number of workers for default
406+
threadpool executor.
407+
Initial patch by Hans Lawrenz.
408+
405409
IDLE
406410
----
407411

0 commit comments

Comments
 (0)