From 30554fdb4fdc169997b234e49ab93655a289d76d Mon Sep 17 00:00:00 2001 From: Pritam Baral Date: Mon, 17 Sep 2018 16:51:40 +0530 Subject: [PATCH] InotifyReloader: Handle `module.__file__ is None` https://github.com/benoitc/gunicorn/commit/0f527a01f427fe06dc0219e2bc8ad6897c8f54fb added a fix for the case when some modules have the `__file__` attr set to `None`, for the polling reloader. Unfortunately, it missed making the same fix for the inotify reloader. This change copies that fix into InotifyReloader --- gunicorn/reloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gunicorn/reloader.py b/gunicorn/reloader.py index c8798854..96b7d288 100644 --- a/gunicorn/reloader.py +++ b/gunicorn/reloader.py @@ -96,7 +96,7 @@ if has_inotify: fnames = [ os.path.dirname(COMPILED_EXT_RE.sub('py', module.__file__)) for module in tuple(sys.modules.values()) - if hasattr(module, '__file__') + if getattr(module, '__file__', None) ] return set(fnames)