From edaf8ef19fff9692cdfe54f0d95c2aca0b308b27 Mon Sep 17 00:00:00 2001 From: "Sergey G. Brester" Date: Thu, 1 Jan 2026 21:26:22 +0100 Subject: [PATCH 1/3] GHA-CI: update python 3.14 + added 3.15 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cde56d34..906c068c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13', '3.14.0-rc.2', pypy3.11] + python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13', '3.14', '3.15.0-alpha.3', pypy3.11] fail-fast: false # Steps represent a sequence of tasks that will be executed as part of the job steps: From 7528fce11b7de0d6df6152c2365540dc1d554561 Mon Sep 17 00:00:00 2001 From: "Sergey G. Brester" Date: Thu, 1 Jan 2026 21:43:27 +0100 Subject: [PATCH 2/3] refactor module loading to use exec_module: load_module is deprecated; closes gh-4126 --- fail2ban/server/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fail2ban/server/utils.py b/fail2ban/server/utils.py index 02a6bc6d..133add24 100644 --- a/fail2ban/server/utils.py +++ b/fail2ban/server/utils.py @@ -29,6 +29,7 @@ import subprocess import sys from threading import Lock import time +import types from ..helpers import getLogger, _merge_dicts, uni_decode from collections import OrderedDict @@ -352,6 +353,7 @@ class Utils(): def load_python_module(pythonModule): pythonModuleName = os.path.splitext( os.path.basename(pythonModule))[0] - mod = importlib.machinery.SourceFileLoader( - pythonModuleName, pythonModule).load_module() + ldr = importlib.machinery.SourceFileLoader(pythonModuleName, pythonModule) + mod = types.ModuleType(ldr.name) + ldr.exec_module(mod) return mod From 247667c9c21c1ab79659fb38141d9d16b4af6504 Mon Sep 17 00:00:00 2001 From: "Sergey G. Brester" Date: Thu, 1 Jan 2026 21:49:12 +0100 Subject: [PATCH 3/3] refactor loading of SMTP action module in tests (deprecated load_module removed in v.3.15) --- fail2ban/tests/action_d/test_smtp.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fail2ban/tests/action_d/test_smtp.py b/fail2ban/tests/action_d/test_smtp.py index a6904255..6e4b926d 100644 --- a/fail2ban/tests/action_d/test_smtp.py +++ b/fail2ban/tests/action_d/test_smtp.py @@ -22,6 +22,7 @@ import threading import unittest import re import sys +import types import importlib from ..dummyjail import DummyJail @@ -296,10 +297,11 @@ try: self.jail = DummyJail() pythonModule = os.path.join(CONFIG_DIR, "action.d", "smtp.py") pythonModuleName = os.path.basename(pythonModule.rstrip(".py")) - customActionModule = importlib.machinery.SourceFileLoader( - pythonModuleName, pythonModule).load_module() + ldr = importlib.machinery.SourceFileLoader(pythonModuleName, pythonModule) + mod = types.ModuleType(ldr.name) + ldr.exec_module(mod) - self.action = customActionModule.Action( + self.action = mod.Action( self.jail, "test", host="localhost:%i" % self.port) self.action.ssl = True