From 21f0adc34617a651f169968869851e34e787f24b Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Mon, 11 Jun 2018 22:04:08 +0300 Subject: [PATCH] Fix AttributeError when --reload was not passed (#1806) Fixes #1805 --- docs/source/news.rst | 7 +++++++ gunicorn/workers/base.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/source/news.rst b/docs/source/news.rst index 3d90aead..8f61b9c8 100644 --- a/docs/source/news.rst +++ b/docs/source/news.rst @@ -2,6 +2,13 @@ Changelog ========= +19.x / not released +=================== + +- 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`) + 19.8.1 / 2018/04/30 =================== diff --git a/gunicorn/workers/base.py b/gunicorn/workers/base.py index ce40796f..881efa0f 100644 --- a/gunicorn/workers/base.py +++ b/gunicorn/workers/base.py @@ -137,7 +137,7 @@ class Worker(object): try: self.wsgi = self.app.wsgi() except SyntaxError as e: - if self.cfg.reload == 'off': + if not self.cfg.reload: raise self.log.exception(e)