diff options
author | Yury Selivanov <yury@magic.io> | 2018-01-28 19:09:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-28 19:09:40 (GMT) |
commit | bec2372b7e1da5dfdbadaf242aa8e994b164cace (patch) | |
tree | db2005e235a7e6d82bb49a698eb5b91dd69414c5 /Lib | |
parent | a4d00012565d716db6e6abe1b8f33eaaa4de416e (diff) | |
download | cpython-bec2372b7e1da5dfdbadaf242aa8e994b164cace.zip cpython-bec2372b7e1da5dfdbadaf242aa8e994b164cace.tar.gz cpython-bec2372b7e1da5dfdbadaf242aa8e994b164cace.tar.bz2 |
bpo-32327: Revert loop.run_in_executor behaviour: return a Future. (#5392)
I've run some tests on 3.7 asyncio and it appears that too many
things assume that run_in_executor returns a Future.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/asyncio/base_events.py | 4 | ||||
-rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 7442bf2..09eb440 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -721,7 +721,7 @@ class BaseEventLoop(events.AbstractEventLoop): self._write_to_self() return handle - async def run_in_executor(self, executor, func, *args): + def run_in_executor(self, executor, func, *args): self._check_closed() if self._debug: self._check_callback(func, 'run_in_executor') @@ -730,7 +730,7 @@ class BaseEventLoop(events.AbstractEventLoop): if executor is None: executor = concurrent.futures.ThreadPoolExecutor() self._default_executor = executor - return await futures.wrap_future( + return futures.wrap_future( executor.submit(func, *args), loop=self) def set_default_executor(self, executor): diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 822338f..19cf1e6 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2999,9 +2999,8 @@ class RunCoroutineThreadsafeTests(test_utils.TestCase): def task_factory(loop, coro): raise NameError - run = self.loop.create_task( - self.loop.run_in_executor( - None, lambda: self.target(advance_coro=True))) + run = self.loop.run_in_executor( + None, lambda: self.target(advance_coro=True)) # Set exception handler callback = test_utils.MockCallback() |