summaryrefslogtreecommitdiff
path: root/dev-python/cheetah3/files/cheetah3-3.4.0-py315.patch
blob: e33e47269b0511deb8c161c8bc95a16b8246b937 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From f935b58cdf47570b288e59a8a19e157d5909f7ac Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Fri, 17 Jul 2026 15:07:49 +1000
Subject: [PATCH] Stop using load_module() in compat

load_module() has been deprecated effectively since it was added,
replaced by exec_module in Python 3.5, switch to using that, since
load_module() was removed in Python 3.15.

Note this effectively removes support for Python 3.4, but I can reenable
that if you prefer.
---
 Cheetah/compat.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Cheetah/compat.py b/Cheetah/compat.py
index 78cfcddd..78105065 100644
--- a/Cheetah/compat.py
+++ b/Cheetah/compat.py
@@ -53,7 +53,9 @@ def cache_from_source(path, debug_override=None):
 
     def load_module_from_file(base_name, module_name, filename):
         specs = importlib.util.spec_from_file_location(module_name, filename)
-        return specs.loader.load_module()
+        module = importlib.util.module_from_spec(specs)
+        specs.loader.exec_module(module)
+        return module
 
     new_module = types.ModuleType