From 979396bb1e2b9f076459e9e086b1656296fd7ae2 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 11 Feb 2018 19:25:38 +0100 Subject: asyncio.async has been scheduled for removal for a long time now move to asyncio.ensure_future --- slixmpp/xmlstream/handler/coroutine_callback.py | 2 +- slixmpp/xmlstream/xmlstream.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'slixmpp/xmlstream') diff --git a/slixmpp/xmlstream/handler/coroutine_callback.py b/slixmpp/xmlstream/handler/coroutine_callback.py index 8ad9572e..1ca4ab0a 100644 --- a/slixmpp/xmlstream/handler/coroutine_callback.py +++ b/slixmpp/xmlstream/handler/coroutine_callback.py @@ -78,7 +78,7 @@ class CoroutineCallback(BaseHandler): :meth:`prerun()`. Defaults to ``False``. """ if not self._instream or instream: - asyncio.async(self._pointer(payload)) + asyncio.ensure_future(self._pointer(payload)) if self._once: self._destroy = True del self._pointer diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index 2ab9a352..93652815 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -285,7 +285,7 @@ class XMLStream(asyncio.BaseProtocol): self.disable_starttls = disable_starttls self.event("connecting") - self._current_connection_attempt = asyncio.async(self._connect_routine()) + self._current_connection_attempt = asyncio.ensure_future(self._connect_routine()) @asyncio.coroutine def _connect_routine(self): @@ -322,7 +322,7 @@ class XMLStream(asyncio.BaseProtocol): log.debug('Connection failed: %s', e) self.event("connection_failed", e) self.connect_loop_wait = self.connect_loop_wait * 2 + 1 - self._current_connection_attempt = asyncio.async(self._connect_routine()) + self._current_connection_attempt = asyncio.ensure_future(self._connect_routine()) def process(self, *, forever=True, timeout=None): """Process all the available XMPP events (receiving or sending data on the @@ -558,7 +558,7 @@ class XMLStream(asyncio.BaseProtocol): pem_cert = ssl.DER_cert_to_PEM_cert(der_cert) self.event('ssl_cert', pem_cert) - asyncio.async(ssl_coro()) + asyncio.ensure_future(ssl_coro()) def _start_keepalive(self, event): """Begin sending whitespace periodically to keep the connection alive. @@ -777,7 +777,7 @@ class XMLStream(asyncio.BaseProtocol): old_exception(e) else: self.exception(e) - asyncio.async(handler_callback_routine(handler_callback)) + asyncio.ensure_future(handler_callback_routine(handler_callback)) else: try: handler_callback(data) -- cgit v1.2.3