Skip to content

Commit

Permalink
fix: asyncio.async() removed in py3.7, use ensure_future
Browse files Browse the repository at this point in the history
  • Loading branch information
nicfit committed Apr 2, 2018
1 parent 7afbd03 commit 5bb5c99
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions vexmpp/ssl_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ def _force_close(self, exc):
self._trace_logger.debug("_force_close called")
self._remove_rw()
if self._state == _State.CLOSED:
# don’t raise here
raise self._invalid_state("_force_close called")
return

self._state = _State.CLOSED

Expand Down Expand Up @@ -314,7 +312,8 @@ def _tls_do_handshake(self):

if self._tls_post_handshake_callback:
self._trace_logger.debug("post handshake scheduled via callback")
task = asyncio.async(self._tls_post_handshake_callback(self))
task = asyncio.ensure_future(
self._tls_post_handshake_callback(self))
task.add_done_callback(self._tls_post_handshake_done)
self._tls_post_handshake_callback = None
else:
Expand Down

0 comments on commit 5bb5c99

Please sign in to comment.