From 54a7761fccaa4647608792889f50ad02c2dffad9 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 29 Sep 2026 13:56:54 +0200 Subject: [PATCH] Tweak load_module_from_file to work on Python 3.15 `create_module` is allowed to return None, which needs additional logic to handle correctly, so we switch to using `module_from_spec` to does all that for us. --- sqlobject/compat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlobject/compat.py b/sqlobject/compat.py index fc8edf25..bcd4203c 100644 --- a/sqlobject/compat.py +++ b/sqlobject/compat.py @@ -48,8 +48,8 @@ def load_module_from_file(base_name, module_name, filename): def load_module_from_file(base_name, module_name, filename): specs = importlib.util.spec_from_file_location(module_name, filename) loader = specs.loader - if hasattr(loader, 'create_module'): - module = loader.create_module(specs) + if hasattr(importlib.util, 'module_from_spec'): + module = importlib.util.module_from_spec(specs) else: module = None if module is None: