From a244b149b15c4417b4f0a4b4a57a1f8c296e968e Mon Sep 17 00:00:00 2001 From: Daniel Bibik <55541040+Boring-Mind@users.noreply.github.com> Date: Mon, 10 May 2021 12:31:29 +0300 Subject: [PATCH] Fix compatibility with latest eventlet Fix issue with import error while using latest eventlet (>=0.30.3). Changes made in eventlet: https://github.com/benoitc/gunicorn/pull/2581 --- gunicorn/workers/geventlet.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gunicorn/workers/geventlet.py b/gunicorn/workers/geventlet.py index ffdb206c0..06477e74d 100644 --- a/gunicorn/workers/geventlet.py +++ b/gunicorn/workers/geventlet.py @@ -17,7 +17,13 @@ from eventlet import hubs, greenthread from eventlet.greenio import GreenSocket -from eventlet.wsgi import ALREADY_HANDLED as EVENTLET_ALREADY_HANDLED + +try: + from eventlet.wsgi import ALREADY_HANDLED as EVENTLET_ALREADY_HANDLED +except ImportError: + # Since eventlet 0.30.3 + from eventlet.wsgi import WSGI_LOCAL as EVENTLET_ALREADY_HANDLED + import greenlet from gunicorn.workers.base_async import AsyncWorker