Skip to content

Commit 07a4990

Browse files
author
Release Manager
committed
sagemathgh-39423: Use import_module instead of find_spec Otherwise the test would fail with meson editable install. See https://g ithub.com/sagemath/sage/actions/runs/13003203795/job/36265539648 . Looks like the function was last changed in sagemath#36407. There was no discussion why the simple implementation is not used. This is part of the fix for this test. The other part needed is sagemath#39498 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. (can't really test, but see sagemath#39369) - [ ] I have updated the documentation and checked the documentation preview. (no documentation change) ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39423 Reported by: user202729 Reviewer(s): Tobias Diez
2 parents 68062d6 + ef72c43 commit 07a4990

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/sage/misc/dev_tools.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def load_submodules(module=None, exclude_pattern=None):
171171
load sage.geometry.polyhedron.ppl_lattice_polygon... succeeded
172172
"""
173173
from .package_dir import walk_packages
174-
import importlib.util
174+
import importlib
175175

176176
if module is None:
177177
import sage
@@ -195,12 +195,8 @@ def load_submodules(module=None, exclude_pattern=None):
195195
try:
196196
sys.stdout.write("load %s..." % module_name)
197197
sys.stdout.flush()
198-
# see
199-
# https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
200-
spec = importer.find_spec(module_name)
201-
module = importlib.util.module_from_spec(spec)
202-
sys.modules[module_name] = module
203-
spec.loader.exec_module(module)
198+
module = importlib.import_module(module_name)
199+
assert sys.modules[module_name] is module
204200
sys.stdout.write(" succeeded\n")
205201
except (ValueError, AttributeError, TypeError, ImportError):
206202
# we might get error because of cython code that has been

0 commit comments

Comments
 (0)