From 0a88d19ddf29b461b819b66e49ea313c89ab576c Mon Sep 17 00:00:00 2001 From: Diego Oliveira Date: Sat, 26 May 2018 10:22:42 -0300 Subject: [PATCH 1/6] Move the module async to _async --- gunicorn/workers/{async.py => _async.py} | 0 gunicorn/workers/geventlet.py | 2 +- gunicorn/workers/ggevent.py | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename gunicorn/workers/{async.py => _async.py} (100%) diff --git a/gunicorn/workers/async.py b/gunicorn/workers/_async.py similarity index 100% rename from gunicorn/workers/async.py rename to gunicorn/workers/_async.py diff --git a/gunicorn/workers/geventlet.py b/gunicorn/workers/geventlet.py index f0bb0649..0c0fa1dc 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._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..ac9011be 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._async import AsyncWorker from gunicorn.http.wsgi import sendfile as o_sendfile VERSION = "gevent/%s gunicorn/%s" % (gevent.__version__, gunicorn.__version__) From 43e31c366b79d9e212bcbc9ad7bae788539bd62f Mon Sep 17 00:00:00 2001 From: Diego Oliveira Date: Sat, 26 May 2018 10:42:15 -0300 Subject: [PATCH 2/6] Fix gaiohttp worker --- .gitignore | 2 ++ THANKS | 1 + docs/source/news.rst | 8 ++++++++ gunicorn/workers/__init__.py | 2 +- gunicorn/workers/_gaiohttp.py | 2 +- requirements_test.txt | 4 ++-- tests/test_gaiohttp.py | 2 +- 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 2cc38924..c0391bdb 100755 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ examples/frameworks/pylonstest/pylonstest.egg-info/ MANIFEST nohup.out setuptools-* +.cache +.eggs 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 3d90aead..eb9c4e49 100644 --- a/docs/source/news.rst +++ b/docs/source/news.rst @@ -2,6 +2,14 @@ Changelog ========= +19.9.0 / 2018/05/26 +=================== + +- the internal module `gunicorn.workers.async` was renamed to `gunicorn.workers.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..fceaa03c 100644 --- a/gunicorn/workers/__init__.py +++ b/gunicorn/workers/__init__.py @@ -17,6 +17,6 @@ SUPPORTED_WORKERS = { } -if sys.version_info >= (3, 3): +if sys.version_info >= (3, 4): # gaiohttp worker can be used with Python 3.3+ 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/requirements_test.txt b/requirements_test.txt index a99b558b..30cce5ed 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,3 +1,3 @@ coverage>=4.0,<4.4 # TODO: https://github.com/benoitc/gunicorn/issues/1548 -pytest==3.0.5 -pytest-cov==2.4.0 +pytest +pytest-cov 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) From 5a82e7c068ecf01cbdb4d59848149a44a8c6b35f Mon Sep 17 00:00:00 2001 From: Diego Oliveira Date: Sat, 26 May 2018 17:11:33 -0300 Subject: [PATCH 3/6] Change _async to base_async --- docs/source/news.rst | 2 +- gunicorn/workers/{_async.py => base_async.py} | 0 gunicorn/workers/geventlet.py | 2 +- gunicorn/workers/ggevent.py | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename gunicorn/workers/{_async.py => base_async.py} (100%) diff --git a/docs/source/news.rst b/docs/source/news.rst index eb9c4e49..ae28a7cb 100644 --- a/docs/source/news.rst +++ b/docs/source/news.rst @@ -5,7 +5,7 @@ Changelog 19.9.0 / 2018/05/26 =================== -- the internal module `gunicorn.workers.async` was renamed to `gunicorn.workers.async` +- 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`) 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 0c0fa1dc..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 ac9011be..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__) From 72dde4336ddd9f9f53410011ad35ada866a93c4f Mon Sep 17 00:00:00 2001 From: Diego Oliveira Date: Sun, 3 Jun 2018 11:38:39 -0300 Subject: [PATCH 4/6] Fix style issues and revert some unrelated changes --- .gitignore | 2 -- docs/source/news.rst | 4 ++-- requirements_test.txt | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index c0391bdb..2cc38924 100755 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,3 @@ examples/frameworks/pylonstest/pylonstest.egg-info/ MANIFEST nohup.out setuptools-* -.cache -.eggs diff --git a/docs/source/news.rst b/docs/source/news.rst index ae28a7cb..0d7b494d 100644 --- a/docs/source/news.rst +++ b/docs/source/news.rst @@ -2,10 +2,10 @@ Changelog ========= -19.9.0 / 2018/05/26 +19.9.0 / not released =================== -- the internal module `gunicorn.workers.async` was renamed to `gunicorn.workers.base_async` +- 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`) diff --git a/requirements_test.txt b/requirements_test.txt index 30cce5ed..a99b558b 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,3 +1,3 @@ coverage>=4.0,<4.4 # TODO: https://github.com/benoitc/gunicorn/issues/1548 -pytest -pytest-cov +pytest==3.0.5 +pytest-cov==2.4.0 From 07dc7167003d231364991416080367cf103a2c26 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Sun, 3 Jun 2018 18:35:23 +0300 Subject: [PATCH 5/6] markup tweaks --- docs/source/news.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/news.rst b/docs/source/news.rst index 0d7b494d..05a4b413 100644 --- a/docs/source/news.rst +++ b/docs/source/news.rst @@ -3,10 +3,10 @@ Changelog ========= 19.9.0 / not released -=================== +===================== - The internal module ``gunicorn.workers.async`` was renamed to ``gunicorn.workers.base_async`` - since ``async`` is now a reserved word in Python 3.7 + since ``async`` is now a reserved word in Python 3.7. (:pr:`1527`) From d338fe16f897b81b70bd4c4b6377f6ad269aca58 Mon Sep 17 00:00:00 2001 From: Diego Oliveira Date: Sat, 9 Jun 2018 08:39:25 -0300 Subject: [PATCH 6/6] Fix comment about python version --- gunicorn/workers/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gunicorn/workers/__init__.py b/gunicorn/workers/__init__.py index fceaa03c..074e0012 100644 --- a/gunicorn/workers/__init__.py +++ b/gunicorn/workers/__init__.py @@ -18,5 +18,5 @@ SUPPORTED_WORKERS = { if sys.version_info >= (3, 4): - # gaiohttp worker can be used with Python 3.3+ only. + # gaiohttp worker can be used with Python 3.4+ only. SUPPORTED_WORKERS["gaiohttp"] = "gunicorn.workers.gaiohttp.AiohttpWorker"