39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
From 4601f50d98cffcb182fddb04f8a78c795004bc73 Mon Sep 17 00:00:00 2001
|
|
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
|
|
Date: Wed, 6 Sep 2023 08:31:29 +0200
|
|
Subject: [PATCH] Py 3.12 compat - do not use the obsoleted imp module
|
|
|
|
---
|
|
offlineimap/localeval.py | 11 ++++-------
|
|
1 file changed, 4 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/offlineimap/localeval.py b/offlineimap/localeval.py
|
|
index 91686666..03ab1b66 100644
|
|
--- a/offlineimap/localeval.py
|
|
+++ b/offlineimap/localeval.py
|
|
@@ -16,7 +16,7 @@
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
-import imp
|
|
+import importlib.util
|
|
|
|
|
|
class LocalEval:
|
|
@@ -28,12 +28,9 @@ def __init__(self, path=None):
|
|
if path is not None:
|
|
# FIXME: limit opening files owned by current user with rights set
|
|
# to fixed mode 644.
|
|
- foo = open(path, 'r')
|
|
- module = imp.load_module(
|
|
- '<none>',
|
|
- foo,
|
|
- path,
|
|
- ('', 'r', imp.PY_SOURCE))
|
|
+ spec = importlib.util.spec_from_file_location('<none>', path)
|
|
+ module = importlib.util.module_from_spec(spec)
|
|
+ spec.loader.exec_module(module)
|
|
for attr in dir(module):
|
|
self.namespace[attr] = getattr(module, attr)
|
|
|