1
0
forked from pool/python-bottle
python-bottle/update-module-loader.patch
Steve Kowalik f5b1d227c3 - Add patch update-module-loader.patch:
* Add find_spec to the magic bottle.ext loader, Python 3.12 no longer
    calls find_module.
- Switch to pyproject and autosetup macros.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bottle?expand=0&rev=53
2023-10-18 05:47:01 +00:00

33 lines
1.2 KiB
Diff

From ca6762c559c5e71e0dff71dc97eb4c6b3ed9bbcd Mon Sep 17 00:00:00 2001
From: Marcel Hellkamp <marc@gsites.de>
Date: Sun, 12 Jun 2022 15:15:35 +0200
Subject: [PATCH] Fix #1378: Module loader should move from find_mdoule to
find_spec.
---
bottle.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
Index: bottle-0.12.25/bottle.py
===================================================================
--- bottle-0.12.25.orig/bottle.py
+++ bottle-0.12.25/bottle.py
@@ -1803,10 +1803,15 @@ class _ImportRedirect(object):
'__all__': [], '__loader__': self})
sys.meta_path.append(self)
+ def find_spec(self, fullname, path, target=None):
+ if '.' not in fullname: return
+ if fullname.rsplit('.', 1)[0] != self.name: return
+ from importlib.util import spec_from_loader
+ return spec_from_loader(fullname, self)
+
def find_module(self, fullname, path=None):
if '.' not in fullname: return
- packname = fullname.rsplit('.', 1)[0]
- if packname != self.name: return
+ if fullname.rsplit('.', 1)[0] != self.name: return
return self
def load_module(self, fullname):