Skip to content

Commit 09166b6

Browse files
author
Neil
committed
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.
1 parent 847875a commit 09166b6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎sqlobject/compat.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def load_module_from_file(base_name, module_name, filename):
4848
def load_module_from_file(base_name, module_name, filename):
4949
specs = importlib.util.spec_from_file_location(module_name, filename)
5050
loader = specs.loader
51-
if hasattr(loader, 'create_module'):
52-
module = loader.create_module(specs)
51+
if hasattr(importlib.util, 'module_from_spec'):
52+
module = importlib.util.module_from_spec(specs)
5353
else:
5454
module = None
5555
if module is None:

0 commit comments

Comments
 (0)