diff -r e5149789e4ea Doc/library/asyncio-eventloop.rst --- a/Doc/library/asyncio-eventloop.rst Sun Apr 17 20:31:51 2016 +0300 +++ b/Doc/library/asyncio-eventloop.rst Mon Apr 18 14:50:40 2016 -0400 @@ -634,6 +634,11 @@ pool of processes). By default, an event loop uses a thread pool executor (:class:`~concurrent.futures.ThreadPoolExecutor`). +.. versionchanged:: 3.5 + :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. + .. coroutinemethod:: BaseEventLoop.run_in_executor(executor, func, \*args) Arrange for a *func* to be called in the specified executor. diff -r e5149789e4ea Lib/asyncio/base_events.py --- a/Lib/asyncio/base_events.py Sun Apr 17 20:31:51 2016 +0300 +++ b/Lib/asyncio/base_events.py Mon Apr 18 14:50:40 2016 -0400 @@ -43,7 +43,8 @@ __all__ = ['BaseEventLoop'] -# Argument for default thread pool executor creation. +# Argument for default thread pool executor creation. Only used on Python 3.4 +# and earlier. _MAX_WORKERS = 5 # Minimum number of _scheduled timer handles before cleanup of @@ -544,7 +545,12 @@ if executor is None: executor = self._default_executor if executor is None: - executor = concurrent.futures.ThreadPoolExecutor(_MAX_WORKERS) + # Python 3.5 ThreadPoolExecutor has its own default for + # max_workers so use that. + if compat.PY35: + executor = concurrent.futures.ThreadPoolExecutor() + else: + executor = concurrent.futures.ThreadPoolExecutor(_MAX_WORKERS) self._default_executor = executor return futures.wrap_future(executor.submit(func, *args), loop=self)