mirror of https://github.com/python/cpython
Merge 3.5 (issue #26796)
This commit is contained in:
commit
6330f2a5ce
|
@ -671,6 +671,13 @@ pool of processes). By default, an event loop uses a thread pool executor
|
||||||
|
|
||||||
This method is a :ref:`coroutine <coroutine>`.
|
This method is a :ref:`coroutine <coroutine>`.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.5.3
|
||||||
|
:meth:`BaseEventLoop.run_in_executor` no longer configures the
|
||||||
|
``max_workers`` of the thread pool executor it creates, instead
|
||||||
|
leaving it up to the thread pool executor
|
||||||
|
(:class:`~concurrent.futures.ThreadPoolExecutor`) to set the
|
||||||
|
default.
|
||||||
|
|
||||||
.. method:: AbstractEventLoop.set_default_executor(executor)
|
.. method:: AbstractEventLoop.set_default_executor(executor)
|
||||||
|
|
||||||
Set the default executor used by :meth:`run_in_executor`.
|
Set the default executor used by :meth:`run_in_executor`.
|
||||||
|
|
|
@ -41,9 +41,6 @@ from .log import logger
|
||||||
__all__ = ['BaseEventLoop']
|
__all__ = ['BaseEventLoop']
|
||||||
|
|
||||||
|
|
||||||
# Argument for default thread pool executor creation.
|
|
||||||
_MAX_WORKERS = 5
|
|
||||||
|
|
||||||
# Minimum number of _scheduled timer handles before cleanup of
|
# Minimum number of _scheduled timer handles before cleanup of
|
||||||
# cancelled handles is performed.
|
# cancelled handles is performed.
|
||||||
_MIN_SCHEDULED_TIMER_HANDLES = 100
|
_MIN_SCHEDULED_TIMER_HANDLES = 100
|
||||||
|
@ -620,7 +617,7 @@ class BaseEventLoop(events.AbstractEventLoop):
|
||||||
if executor is None:
|
if executor is None:
|
||||||
executor = self._default_executor
|
executor = self._default_executor
|
||||||
if executor is None:
|
if executor is None:
|
||||||
executor = concurrent.futures.ThreadPoolExecutor(_MAX_WORKERS)
|
executor = concurrent.futures.ThreadPoolExecutor()
|
||||||
self._default_executor = executor
|
self._default_executor = executor
|
||||||
return futures.wrap_future(executor.submit(func, *args), loop=self)
|
return futures.wrap_future(executor.submit(func, *args), loop=self)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue