@@ -263,15 +263,17 @@ def _tool_module(self):
263263
264264 tooldir = sys .modules ['SCons.Tool' ].__path__ [0 ]
265265 importer = zipimport .zipimporter (tooldir )
266- if not hasattr (importer , 'find_spec' ):
267- # zipimport only added find_spec, exec_module in 3.10,
268- # unlike importlib, where they've been around since 3.4.
269- # If we don't have 'em, use the old way.
270- module = importer .load_module (full_name )
271- else :
266+ # TODO: remove this check when Python 3.10 becomes base version
267+ if hasattr (importer , 'find_spec' ):
268+ # Note zipimporter got these methods later than importlib
272269 spec = importer .find_spec (full_name )
273- module = importlib .util .module_from_spec (spec )
274- importer .exec_module (module )
270+ mod = importlib .util .module_from_spec (spec )
271+ importer .exec_module (mod )
272+ else :
273+ # Older Pythons. load_module dropped entirely from
274+ # zimpiporter in 3.15, but a new Python won't take this
275+ # branch anyway so it's okay to ignore checker gripes here.
276+ mod = importer .load_module (full_name )
275277 sys .modules [full_name ] = module
276278 setattr (SCons .Tool , self .name , module )
277279 return module
0 commit comments