14
0
Files
python-tornado/asyncio.patch

52 lines
1.6 KiB
Diff

From: Benjamin Drung <benjamin.drung@cloud.ionos.com>
Date: Thu, 15 Nov 2018 16:18:51 +0100
Subject: [PATCH] Add support for Python 3.7
---
tornado/gen.py | 3 +--
tornado/queues.py | 1 -
tornado/test/asyncio_test.py | 3 ++-
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/tornado/gen.py b/tornado/gen.py
index 99f9106..bdb32ff 100644
--- a/tornado/gen.py
+++ b/tornado/gen.py
@@ -482,9 +482,8 @@ class WaitIterator(object):
self.current_future = done
self.current_index = self._unfinished.pop(done)
- @coroutine
def __aiter__(self):
- raise Return(self)
+ return self
def __anext__(self):
if self.done():
diff --git a/tornado/queues.py b/tornado/queues.py
index 0041a80..141c539 100644
--- a/tornado/queues.py
+++ b/tornado/queues.py
@@ -253,7 +253,6 @@ class Queue(object):
"""
return self._finished.wait(timeout)
- @gen.coroutine
def __aiter__(self):
return _QueueIterator(self)
diff --git a/tornado/test/asyncio_test.py b/tornado/test/asyncio_test.py
index d0e3f2b..ae9125f 100644
--- a/tornado/test/asyncio_test.py
+++ b/tornado/test/asyncio_test.py
@@ -46,7 +46,8 @@ class AsyncIOLoopTest(AsyncTestCase):
if hasattr(asyncio, 'ensure_future'):
ensure_future = asyncio.ensure_future
else:
- ensure_future = asyncio.async
+ # async is a reserved word in Python 3.7
+ ensure_future = getattr(asyncio, "async")
x = yield ensure_future(
asyncio.get_event_loop().run_in_executor(None, lambda: 42))