mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Raise statement normalization in Lib/.
This commit is contained in:
parent
8b3febef2f
commit
ce36ad8a46
80 changed files with 502 additions and 530 deletions
|
|
@ -146,7 +146,7 @@ class ModuleFinder:
|
|||
self.msgout(4, "determine_parent ->", parent)
|
||||
return parent
|
||||
if pname.count(".") < level:
|
||||
raise ImportError, "relative importpath too deep"
|
||||
raise ImportError("relative importpath too deep")
|
||||
pname = ".".join(pname.split(".")[:-level])
|
||||
parent = self.modules[pname]
|
||||
self.msgout(4, "determine_parent ->", parent)
|
||||
|
|
@ -191,7 +191,7 @@ class ModuleFinder:
|
|||
self.msgout(4, "find_head_package ->", (q, tail))
|
||||
return q, tail
|
||||
self.msgout(4, "raise ImportError: No module named", qname)
|
||||
raise ImportError, "No module named " + qname
|
||||
raise ImportError("No module named " + qname)
|
||||
|
||||
def load_tail(self, q, tail):
|
||||
self.msgin(4, "load_tail", q, tail)
|
||||
|
|
@ -204,7 +204,7 @@ class ModuleFinder:
|
|||
m = self.import_module(head, mname, m)
|
||||
if not m:
|
||||
self.msgout(4, "raise ImportError: No module named", mname)
|
||||
raise ImportError, "No module named " + mname
|
||||
raise ImportError("No module named " + mname)
|
||||
self.msgout(4, "load_tail ->", m)
|
||||
return m
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ class ModuleFinder:
|
|||
subname = "%s.%s" % (m.__name__, sub)
|
||||
submod = self.import_module(sub, subname, m)
|
||||
if not submod:
|
||||
raise ImportError, "No module named " + subname
|
||||
raise ImportError("No module named " + subname)
|
||||
|
||||
def find_all_submodules(self, m):
|
||||
if not m.__path__:
|
||||
|
|
@ -291,7 +291,7 @@ class ModuleFinder:
|
|||
elif type == imp.PY_COMPILED:
|
||||
if fp.read(4) != imp.get_magic():
|
||||
self.msgout(2, "raise ImportError: Bad magic number", pathname)
|
||||
raise ImportError, "Bad magic number in %s" % pathname
|
||||
raise ImportError("Bad magic number in %s" % pathname)
|
||||
fp.read(4)
|
||||
co = marshal.load(fp)
|
||||
else:
|
||||
|
|
@ -470,7 +470,7 @@ class ModuleFinder:
|
|||
fullname = name
|
||||
if fullname in self.excludes:
|
||||
self.msgout(3, "find_module -> Excluded", fullname)
|
||||
raise ImportError, name
|
||||
raise ImportError(name)
|
||||
|
||||
if path is None:
|
||||
if name in sys.builtin_module_names:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue