Blob Blame History Raw
From 63a660b8a9167ffccdf2e3cb5a8c9f51a3487574 Mon Sep 17 00:00:00 2001
From: Carl George <carl@george.computer>
Date: Tue, 19 Jun 2018 15:09:27 -0500
Subject: [PATCH] switch from asyncio.async to asyncio.ensure_future

Python 3.7 removes asyncio.async (it has been deprecated since 3.4.4).
It was replaced by asyncio.ensure_future.

https://docs.python.org/3.7/whatsnew/3.7.html
https://docs.python.org/3.6/library/asyncio-task.html#asyncio.async
---
 examples/asyncio-python-embed.py  | 4 ++--
 ptpython/contrib/asyncssh_repl.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/asyncio-python-embed.py b/examples/asyncio-python-embed.py
index eadad2d..280d4b5 100755
--- a/examples/asyncio-python-embed.py
+++ b/examples/asyncio-python-embed.py
@@ -45,8 +45,8 @@ def interactive_shell():
 
 
 def main():
-    asyncio.async(print_counter())
-    asyncio.async(interactive_shell())
+    asyncio.ensure_future(print_counter())
+    asyncio.ensure_future(interactive_shell())
 
     loop.run_forever()
     loop.close()
diff --git a/ptpython/contrib/asyncssh_repl.py b/ptpython/contrib/asyncssh_repl.py
index 02b8fd9..a4df444 100644
--- a/ptpython/contrib/asyncssh_repl.py
+++ b/ptpython/contrib/asyncssh_repl.py
@@ -92,7 +92,7 @@ def connection_made(self, chan):
         self._chan = chan
 
         # Run REPL interface.
-        f = asyncio.async(self.cli.run_async())
+        f = asyncio.ensure_future(self.cli.run_async())
 
         # Close channel when done.
         def done(_):