diff --git a/THANKS b/THANKS index f23b74ed..ff271ad1 100644 --- a/THANKS +++ b/THANKS @@ -49,6 +49,7 @@ Dariusz Suchojad David Vincelli David Wolever Denis Bilenko +Diego Oliveira Dima Barsky Djoume Salvetti Dmitry Medvinsky diff --git a/docs/source/news.rst b/docs/source/news.rst index 8f61b9c8..3267047e 100644 --- a/docs/source/news.rst +++ b/docs/source/news.rst @@ -8,6 +8,9 @@ Changelog - fix: prevent raising :exc:`AttributeError` when ``--reload`` is not passed in case of a :exc:`SyntaxError` raised from the WSGI application. (:issue:`1805`, :pr:`1806`) +- The internal module ``gunicorn.workers.async`` was renamed to ``gunicorn.workers.base_async`` + since ``async`` is now a reserved word in Python 3.7. + (:pr:`1527`) 19.8.1 / 2018/04/30 =================== diff --git a/gunicorn/workers/__init__.py b/gunicorn/workers/__init__.py index 05a3e286..074e0012 100644 --- a/gunicorn/workers/__init__.py +++ b/gunicorn/workers/__init__.py @@ -17,6 +17,6 @@ SUPPORTED_WORKERS = { } -if sys.version_info >= (3, 3): - # gaiohttp worker can be used with Python 3.3+ only. +if sys.version_info >= (3, 4): + # gaiohttp worker can be used with Python 3.4+ only. SUPPORTED_WORKERS["gaiohttp"] = "gunicorn.workers.gaiohttp.AiohttpWorker" diff --git a/gunicorn/workers/_gaiohttp.py b/gunicorn/workers/_gaiohttp.py index cdce4be7..fe378c35 100644 --- a/gunicorn/workers/_gaiohttp.py +++ b/gunicorn/workers/_gaiohttp.py @@ -46,7 +46,7 @@ class AiohttpWorker(base.Worker): super().init_process() def run(self): - self._runner = asyncio.async(self._run(), loop=self.loop) + self._runner = asyncio.ensure_future(self._run(), loop=self.loop) try: self.loop.run_until_complete(self._runner) diff --git a/gunicorn/workers/async.py b/gunicorn/workers/base_async.py similarity index 100% rename from gunicorn/workers/async.py rename to gunicorn/workers/base_async.py diff --git a/gunicorn/workers/geventlet.py b/gunicorn/workers/geventlet.py index f0bb0649..189062c8 100644 --- a/gunicorn/workers/geventlet.py +++ b/gunicorn/workers/geventlet.py @@ -24,7 +24,7 @@ from eventlet.wsgi import ALREADY_HANDLED as EVENTLET_ALREADY_HANDLED import greenlet from gunicorn.http.wsgi import sendfile as o_sendfile -from gunicorn.workers.async import AsyncWorker +from gunicorn.workers.base_async import AsyncWorker def _eventlet_sendfile(fdout, fdin, offset, nbytes): while True: diff --git a/gunicorn/workers/ggevent.py b/gunicorn/workers/ggevent.py index 34ee72a8..fb9d9194 100644 --- a/gunicorn/workers/ggevent.py +++ b/gunicorn/workers/ggevent.py @@ -27,7 +27,7 @@ from gevent import pywsgi import gunicorn from gunicorn.http.wsgi import base_environ -from gunicorn.workers.async import AsyncWorker +from gunicorn.workers.base_async import AsyncWorker from gunicorn.http.wsgi import sendfile as o_sendfile VERSION = "gevent/%s gunicorn/%s" % (gevent.__version__, gunicorn.__version__) diff --git a/tests/test_gaiohttp.py b/tests/test_gaiohttp.py index 6a08c413..e58f36c1 100644 --- a/tests/test_gaiohttp.py +++ b/tests/test_gaiohttp.py @@ -50,7 +50,7 @@ class WorkerTests(unittest.TestCase): self.worker.loop = mock.Mock() self.worker.run() - self.assertTrue(m_asyncio.async.called) + self.assertTrue(m_asyncio.ensure_future.called) self.assertTrue(self.worker.loop.run_until_complete.called) self.assertTrue(self.worker.loop.close.called)