Skip to content

Commit

Permalink
Replace calls to asyncio.async with asyncio.ensure_future. Fixes #42
Browse files Browse the repository at this point in the history
  • Loading branch information
fenhl committed Jul 3, 2018
1 parent f32e403 commit fac130b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aioimaplib/aioimaplib.py
Expand Up @@ -382,7 +382,7 @@ def _handle_line(self, line, current_cmd):
return

if self.state == CONNECTED:
asyncio.async(self.welcome(line))
asyncio.ensure_future(self.welcome(line))
elif tagged_status_response_re.match(line):
self._response_done(line)
elif current_cmd is not None:
Expand Down Expand Up @@ -597,7 +597,7 @@ def simple_command(self, name, *args):

@asyncio.coroutine
def wait_async_pending_commands(self):
yield from asyncio.wait([asyncio.async(cmd.wait()) for cmd in self.pending_async_commands.values()])
yield from asyncio.wait([asyncio.ensure_future(cmd.wait()) for cmd in self.pending_async_commands.values()])

@asyncio.coroutine
def wait(self, state_regexp):
Expand Down Expand Up @@ -760,8 +760,8 @@ def wait_server_push(self, timeout=TWENTY_NINE_MINUTES):
def idle_start(self, timeout=TWENTY_NINE_MINUTES):
if self._idle_waiter is not None:
self._idle_waiter.cancel()
idle = asyncio.async(self.idle())
self._idle_waiter = self.protocol.loop.call_later(timeout, lambda: asyncio.async(self.stop_wait_server_push()))
idle = asyncio.ensure_future(self.idle())
self._idle_waiter = self.protocol.loop.call_later(timeout, lambda: asyncio.ensure_future(self.stop_wait_server_push()))
yield from self.wait_server_push(self.timeout) # idling continuation
return idle

Expand Down

0 comments on commit fac130b

Please sign in to comment.