bpo-43234: Prohibit non-ThreadPoolExecutor in loop.set_default_executor (GH-24540)

This commit is contained in:
Illia Volochii 2021-07-01 17:46:49 +03:00 committed by GitHub
parent a1092f6249
commit ddd5f36971
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 17 deletions

View file

@ -814,11 +814,7 @@ class BaseEventLoop(events.AbstractEventLoop):
def set_default_executor(self, executor):
if not isinstance(executor, concurrent.futures.ThreadPoolExecutor):
warnings.warn(
'Using the default executor that is not an instance of '
'ThreadPoolExecutor is deprecated and will be prohibited '
'in Python 3.9',
DeprecationWarning, 2)
raise TypeError('executor must be ThreadPoolExecutor instance')
self._default_executor = executor
def _getaddrinfo_debug(self, host, port, family, type, proto, flags):