diff options
author | Collin Winter <collinw@gmail.com> | 2007-08-30 01:19:48 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-08-30 01:19:48 (GMT) |
commit | ce36ad8a467d914eb5c91f33835b9eaea18ee93b (patch) | |
tree | 05bf654f3359e20b455dc300bd860bba5d291c8d /Lib/ihooks.py | |
parent | 8b3febef2f96c35e9aad9db2ef499db040fdefae (diff) | |
download | cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.zip cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.gz cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.bz2 |
Raise statement normalization in Lib/.
Diffstat (limited to 'Lib/ihooks.py')
-rw-r--r-- | Lib/ihooks.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Lib/ihooks.py b/Lib/ihooks.py index 14a20a6..d2eabc4 100644 --- a/Lib/ihooks.py +++ b/Lib/ihooks.py @@ -271,8 +271,8 @@ class ModuleLoader(BasicModuleLoader): elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: - raise ImportError, "Unrecognized module type (%r) for %s" % \ - (type, name) + raise ImportError("Unrecognized module type (%r) for %s" + % (type, name)) finally: if file: file.close() m.__file__ = filename @@ -291,14 +291,13 @@ class FancyModuleLoader(ModuleLoader): if type == PKG_DIRECTORY: initstuff = self.find_module_in_dir("__init__", filename, 0) if not initstuff: - raise ImportError, "No __init__ module in package %s" % name + raise ImportError("No __init__ module in package %s" % name) initfile, initfilename, initinfo = initstuff initsuff, initmode, inittype = initinfo if inittype not in (PY_COMPILED, PY_SOURCE): if initfile: initfile.close() - raise ImportError, \ - "Bad type (%r) for __init__ module in package %s" % ( - inittype, name) + raise ImportError("Bad type (%r) for __init__ module" + " in package %s" % (inittype, name)) path = [filename] file = initfile realfilename = initfilename @@ -361,14 +360,14 @@ class BasicModuleImporter(_Verbose): return self.modules[name] # Fast path stuff = self.loader.find_module(name) if not stuff: - raise ImportError, "No module named %s" % name + raise ImportError("No module named %s" % name) return self.loader.load_module(name, stuff) def reload(self, module, path = None): name = str(module.__name__) stuff = self.loader.find_module(name, path) if not stuff: - raise ImportError, "Module %s not found for reload" % name + raise ImportError("Module %s not found for reload" % name) return self.loader.load_module(name, stuff) def unload(self, module): @@ -439,7 +438,7 @@ class ModuleImporter(BasicModuleImporter): parent = None q = self.import_it(head, qname, parent) if q: return q, tail - raise ImportError, "No module named " + qname + raise ImportError("No module named " + qname) def load_tail(self, q, tail): m = q @@ -450,7 +449,7 @@ class ModuleImporter(BasicModuleImporter): mname = "%s.%s" % (m.__name__, head) m = self.import_it(head, mname, m) if not m: - raise ImportError, "No module named " + mname + raise ImportError("No module named " + mname) return m def ensure_fromlist(self, m, fromlist, recursive=0): @@ -468,11 +467,11 @@ class ModuleImporter(BasicModuleImporter): subname = "%s.%s" % (m.__name__, sub) submod = self.import_it(sub, subname, m) if not submod: - raise ImportError, "No module named " + subname + raise ImportError("No module named " + subname) def import_it(self, partname, fqname, parent, force_load=0): if not partname: - raise ValueError, "Empty module name" + raise ValueError("Empty module name") if not force_load: try: return self.modules[fqname] |