python-bottle/0003-fix-1115-Some-modules-set-__file__-as-None.patch

28 lines
928 B
Diff

From 076f41759ceacb1a804517270392f0ef75adb07f Mon Sep 17 00:00:00 2001
From: Marcel Hellkamp <marc@gsites.de>
Date: Thu, 13 Dec 2018 08:26:27 +0100
Subject: [PATCH] fix #1115: Some modules set __file__ as None
This is not allowed (the __file__ attribute MUST be either a string, or unset),
but seems to happen anyway and is easy to work around in bottle.
---
bottle.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bottle.py b/bottle.py
index 01b581e..f254bac 100644
--- a/bottle.py
+++ b/bottle.py
@@ -3156,7 +3156,7 @@ class FileCheckerThread(threading.Thread):
files = dict()
for module in list(sys.modules.values()):
- path = getattr(module, '__file__', '')
+ path = getattr(module, '__file__', '') or ''
if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
if path and exists(path): files[path] = mtime(path)
--
2.39.0.windows.2