diff options
author | Brett Cannon <brett@python.org> | 2013-07-04 21:43:24 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-07-04 21:43:24 (GMT) |
commit | cd171c8e92c10d327151400fd8f16b11a4964615 (patch) | |
tree | db734100511572201a54a6b7ce1803bcea4c94da /Lib/distutils/ccompiler.py | |
parent | fff59155d40ede93594eb77f320e0bde658cce28 (diff) | |
download | cpython-cd171c8e92c10d327151400fd8f16b11a4964615.zip cpython-cd171c8e92c10d327151400fd8f16b11a4964615.tar.gz cpython-cd171c8e92c10d327151400fd8f16b11a4964615.tar.bz2 |
Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a)
Diffstat (limited to 'Lib/distutils/ccompiler.py')
-rw-r--r-- | Lib/distutils/ccompiler.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py index bc183fc..911e84d 100644 --- a/Lib/distutils/ccompiler.py +++ b/Lib/distutils/ccompiler.py @@ -3,7 +3,7 @@ Contains CCompiler, an abstract base class that defines the interface for the Distutils compiler abstraction model.""" -import importlib, sys, os, re +import sys, os, re from distutils.errors import * from distutils.spawn import spawn from distutils.file_util import move_file @@ -1013,9 +1013,10 @@ def new_compiler(plat=None, compiler=None, verbose=0, dry_run=0, force=0): try: module_name = "distutils." + module_name - module = importlib.import_module(module_name) + __import__ (module_name) + module = sys.modules[module_name] klass = vars(module)[class_name] - except ModuleNotFoundError: + except ImportError: raise DistutilsModuleError( "can't compile C/C++ code: unable to load module '%s'" % \ module_name) |