fix #1115: Some modules set __file__ as None

Signed-off-by: zhang-liang-pengkun <zhangliangpengkun@xfusion.com>
(cherry picked from commit c9bc0513e8ace456614509e24c3d71f6cf98588a)
This commit is contained in:
zhang-liang-pengkun 2023-12-05 19:15:42 +08:00 committed by openeuler-sync-bot
parent 42fc94fc7b
commit 4d92e14380
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,27 @@
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

View File

@ -1,6 +1,6 @@
Name: python-bottle Name: python-bottle
Version: 0.12.13 Version: 0.12.13
Release: 13 Release: 14
Summary: WSGI micro web-framework for Python. Summary: WSGI micro web-framework for Python.
License: MIT License: MIT
URL: https://github.com/bottlepy/bottle URL: https://github.com/bottlepy/bottle
@ -11,6 +11,7 @@ Patch0001: CVE-2022-31799.patch
Patch0002: 0001-fix-1065-gevent-1.3.0-removes-fast-wsgi-implementati.patch Patch0002: 0001-fix-1065-gevent-1.3.0-removes-fast-wsgi-implementati.patch
Patch0003: 0002-Fix-930-DeprecationWarning-Flags-not-at-the-start-of.patch Patch0003: 0002-Fix-930-DeprecationWarning-Flags-not-at-the-start-of.patch
Patch0004: 0003-Added-Python-3.4-3.7-language-classifiers.patch Patch0004: 0003-Added-Python-3.4-3.7-language-classifiers.patch
Patch0005: 0004-fix-1115-Some-modules-set-__file__-as-None.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python3-devel python3-setuptools BuildRequires: python3-devel python3-setuptools
@ -48,6 +49,9 @@ sed -i '/^#!/d' bottle.py
%exclude %{_bindir}/bottle.py %exclude %{_bindir}/bottle.py
%changelog %changelog
* Tue Dec 05 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 0.12.13-14
- fix #1115: Some modules set __file__ as None
* Fri Dec 01 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 0.12.13-13 * Fri Dec 01 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 0.12.13-13
- Added Python 3.4-3.7 language classifiers - Added Python 3.4-3.7 language classifiers