Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ def call_soon_threadsafe(self, callback, *args):
self._write_to_self()
return handle

@coroutine
def run_in_executor(self, executor, func, *args):
if (coroutines.iscoroutine(func)
or coroutines.iscoroutinefunction(func)):
Expand All @@ -539,7 +540,7 @@ def run_in_executor(self, executor, func, *args):
if executor is None:
executor = concurrent.futures.ThreadPoolExecutor(_MAX_WORKERS)
self._default_executor = executor
return futures.wrap_future(executor.submit(func, *args), loop=self)
return (yield from futures.wrap_future(executor.submit(func, *args), loop=self))

def set_default_executor(self, executor):
self._default_executor = executor
Expand Down
1 change: 1 addition & 0 deletions tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ def run(arg):
res, thread_id = self.loop.run_until_complete(f2)
self.assertEqual(res, 'yo')
self.assertNotEqual(thread_id, threading.get_ident())
self.assertTrue(asyncio.iscoroutine(f2))

def test_reader_callback(self):
r, w = test_utils.socketpair()
Expand Down