summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-08-22 23:05:06 (GMT)
committerCollin Winter <collinw@gmail.com>2007-08-22 23:05:06 (GMT)
commita817e5894b20d68263056bf9af8f1582954b1d8f (patch)
tree2409955c53ffb88f6934f277d66c4fe44011e601 /Tools
parent2d7f6a079df2b4582d7ccc32a7a2a7287d0bf175 (diff)
downloadcpython-a817e5894b20d68263056bf9af8f1582954b1d8f.zip
cpython-a817e5894b20d68263056bf9af8f1582954b1d8f.tar.gz
cpython-a817e5894b20d68263056bf9af8f1582954b1d8f.tar.bz2
Convert raise statements in Tools/.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/bgen/bgen/bgenBuffer.py6
-rw-r--r--Tools/bgen/bgen/bgenGenerator.py2
-rw-r--r--Tools/bgen/bgen/bgenHeapBuffer.py2
-rw-r--r--Tools/bgen/bgen/bgenOutput.py2
-rw-r--r--Tools/bgen/bgen/bgenType.py4
-rw-r--r--Tools/bgen/bgen/scantools.py6
-rw-r--r--Tools/framer/framer/struct.py2
-rw-r--r--Tools/freeze/winmakemakefile.py2
-rwxr-xr-xTools/modulator/genmodule.py4
-rw-r--r--Tools/modulator/varsubst.py2
-rw-r--r--Tools/msi/msi.py2
-rw-r--r--Tools/msi/msilib.py8
-rwxr-xr-xTools/scripts/texi2html.py4
-rwxr-xr-xTools/scripts/untabify.py2
-rw-r--r--Tools/unicode/makeunicodedata.py8
-rw-r--r--Tools/unicode/mkstringprep.py2
16 files changed, 29 insertions, 29 deletions
diff --git a/Tools/bgen/bgen/bgenBuffer.py b/Tools/bgen/bgen/bgenBuffer.py
index 94ab950..98bbfe2 100644
--- a/Tools/bgen/bgen/bgenBuffer.py
+++ b/Tools/bgen/bgen/bgenBuffer.py
@@ -40,7 +40,7 @@ class FixedInputOutputBufferType(InputOnlyType):
def getArgDeclarations(self, name, reference=False, constmode=False, outmode=False):
if reference:
- raise RuntimeError, "Cannot pass buffer types by reference"
+ raise RuntimeError("Cannot pass buffer types by reference")
return (self.getBufferDeclarations(name, constmode, outmode) +
self.getSizeDeclarations(name, outmode))
@@ -57,7 +57,7 @@ class FixedInputOutputBufferType(InputOnlyType):
def getOutputBufferDeclarations(self, name, constmode=False, outmode=False):
if constmode:
- raise RuntimeError, "Cannot use const output buffer"
+ raise RuntimeError("Cannot use const output buffer")
if outmode:
out = "*"
else:
@@ -216,7 +216,7 @@ class StructInputOutputBufferType(FixedInputOutputBufferType):
def getOutputBufferDeclarations(self, name, constmode=False, outmode=False):
if constmode:
- raise RuntimeError, "Cannot use const output buffer"
+ raise RuntimeError("Cannot use const output buffer")
if outmode:
out = "*"
else:
diff --git a/Tools/bgen/bgen/bgenGenerator.py b/Tools/bgen/bgen/bgenGenerator.py
index ae5c06b..e364d01 100644
--- a/Tools/bgen/bgen/bgenGenerator.py
+++ b/Tools/bgen/bgen/bgenGenerator.py
@@ -280,7 +280,7 @@ class MethodGenerator(FunctionGenerator):
a0, args = args[0], args[1:]
t0, n0, m0 = a0
if m0 != InMode:
- raise ValueError, "method's 'self' must be 'InMode'"
+ raise ValueError("method's 'self' must be 'InMode'")
self.itself = Variable(t0, "_self->ob_itself", SelfMode)
self.argumentList.append(self.itself)
FunctionGenerator.parseArgumentList(self, args)
diff --git a/Tools/bgen/bgen/bgenHeapBuffer.py b/Tools/bgen/bgen/bgenHeapBuffer.py
index 930bb7e..fda8d30 100644
--- a/Tools/bgen/bgen/bgenHeapBuffer.py
+++ b/Tools/bgen/bgen/bgenHeapBuffer.py
@@ -18,7 +18,7 @@ class HeapInputOutputBufferType(FixedInputOutputBufferType):
def getOutputBufferDeclarations(self, name, constmode=False, outmode=False):
if constmode:
- raise RuntimeError, "Cannot use const output buffer"
+ raise RuntimeError("Cannot use const output buffer")
if outmode:
out = "*"
else:
diff --git a/Tools/bgen/bgen/bgenOutput.py b/Tools/bgen/bgen/bgenOutput.py
index 53d4f55..bceac59 100644
--- a/Tools/bgen/bgen/bgenOutput.py
+++ b/Tools/bgen/bgen/bgenOutput.py
@@ -83,7 +83,7 @@ def IndentLevel(by = 1):
"""
global _Level
if _Level+by < 0:
- raise Error, "indentation underflow (internal error)"
+ raise Error("indentation underflow (internal error)")
_Level = _Level + by
def DedentLevel(by = 1):
diff --git a/Tools/bgen/bgen/bgenType.py b/Tools/bgen/bgen/bgenType.py
index c988700..dcb0f08 100644
--- a/Tools/bgen/bgen/bgenType.py
+++ b/Tools/bgen/bgen/bgenType.py
@@ -163,7 +163,7 @@ class InputOnlyMixIn:
"Mix-in class to boobytrap passOutput"
def passOutput(self, name):
- raise RuntimeError, "Type '%s' can only be used for input parameters" % self.typeName
+ raise RuntimeError("Type '%s' can only be used for input parameters" % self.typeName)
class InputOnlyType(InputOnlyMixIn, Type):
@@ -174,7 +174,7 @@ class OutputOnlyMixIn:
"Mix-in class to boobytrap passInput"
def passInput(self, name):
- raise RuntimeError, "Type '%s' can only be used for output parameters" % self.typeName
+ raise RuntimeError("Type '%s' can only be used for output parameters" % self.typeName)
class OutputOnlyType(OutputOnlyMixIn, Type):
diff --git a/Tools/bgen/bgen/scantools.py b/Tools/bgen/bgen/scantools.py
index 3d973d0..d03bc93 100644
--- a/Tools/bgen/bgen/scantools.py
+++ b/Tools/bgen/bgen/scantools.py
@@ -420,7 +420,7 @@ if missing: raise "Missing Types"
try:
file = open(filename, 'w')
except IOError as arg:
- raise IOError, (filename, arg)
+ raise IOError(filename, arg)
self.setfiletype(filename)
return file
@@ -461,11 +461,11 @@ if missing: raise "Missing Types"
try:
return open(filename, 'rU')
except IOError as arg:
- raise IOError, (arg, filename)
+ raise IOError(arg, filename)
def getline(self):
if not self.scanfile:
- raise Error, "input file not set"
+ raise Error("input file not set")
self.line = self.scanfile.readline()
if not self.line:
if self._nextinput():
diff --git a/Tools/framer/framer/struct.py b/Tools/framer/framer/struct.py
index 12ea8d7..1289f24 100644
--- a/Tools/framer/framer/struct.py
+++ b/Tools/framer/framer/struct.py
@@ -17,7 +17,7 @@ class Struct:
for _name, type in self.members:
if name == _name:
return type
- raise ValueError, "no member named %s" % name
+ raise ValueError("no member named %s" % name)
def parse(s):
"""Parse a C struct definition.
diff --git a/Tools/freeze/winmakemakefile.py b/Tools/freeze/winmakemakefile.py
index e473fed..7d198c1 100644
--- a/Tools/freeze/winmakemakefile.py
+++ b/Tools/freeze/winmakemakefile.py
@@ -39,7 +39,7 @@ def get_custom_entry_point(subsystem):
try:
return subsystem_details[subsystem][:2]
except KeyError:
- raise ValueError, "The subsystem %s is not known" % subsystem
+ raise ValueError("The subsystem %s is not known" % subsystem)
def makemakefile(outfp, vars, files, target):
diff --git a/Tools/modulator/genmodule.py b/Tools/modulator/genmodule.py
index da30684..7df3983 100755
--- a/Tools/modulator/genmodule.py
+++ b/Tools/modulator/genmodule.py
@@ -63,8 +63,8 @@ class writer:
fn = os.path.join(fn, name)
if os.path.exists(fn):
return open(fn, 'r')
- raise error, 'Template '+name+' not found for '+self._type+' '+ \
- self.name
+ raise error('Template '+name+' not found for '+self._type+' '+ \
+ self.name)
class module(writer):
_type = 'module'
diff --git a/Tools/modulator/varsubst.py b/Tools/modulator/varsubst.py
index 3b33950..473fb55 100644
--- a/Tools/modulator/varsubst.py
+++ b/Tools/modulator/varsubst.py
@@ -29,7 +29,7 @@ class Varsubst:
continue
name = m.group(1)
if not self.dict.has_key(name):
- raise error, 'No such variable: '+name
+ raise error('No such variable: '+name)
value = self.dict[name]
if self.do_useindent and '\n' in value:
value = self._modindent(value, rv)
diff --git a/Tools/msi/msi.py b/Tools/msi/msi.py
index adf470f..a184973 100644
--- a/Tools/msi/msi.py
+++ b/Tools/msi/msi.py
@@ -157,7 +157,7 @@ have_mingw = build_mingw_lib(lib_file, def_file, dll_file, mingw_lib)
dll_path = os.path.join(srcdir, "PCBuild", dll_file)
msilib.set_arch_from_file(dll_path)
if msilib.pe_type(dll_path) != msilib.pe_type("msisupport.dll"):
- raise SystemError, "msisupport.dll for incorrect architecture"
+ raise SystemError("msisupport.dll for incorrect architecture")
if testpackage:
ext = 'px'
diff --git a/Tools/msi/msilib.py b/Tools/msi/msilib.py
index 8aea216..9823e2a 100644
--- a/Tools/msi/msilib.py
+++ b/Tools/msi/msilib.py
@@ -254,7 +254,7 @@ def change_sequence(seq, action, seqno=_Unspecified, cond = _Unspecified):
seqno = seq[i][2]
seq[i] = (action, cond, seqno)
return
- raise ValueError, "Action not found in sequence"
+ raise ValueError("Action not found in sequence")
def add_data(db, table, values):
d = MakeInstaller()
@@ -274,7 +274,7 @@ def add_data(db, table, values):
elif isinstance(field, Binary):
r.SetStream(i+1, field.name)
else:
- raise TypeError, "Unsupported type %s" % field.__class__.__name__
+ raise TypeError("Unsupported type %s" % field.__class__.__name__)
v.Modify(win32com.client.constants.msiViewModifyInsert, r)
r.ClearData()
v.Close()
@@ -398,7 +398,7 @@ class CAB:
sys.stdout.write(line)
sys.stdout.flush()
if not os.path.exists(self.name+".cab"):
- raise IOError, "cabarc failed"
+ raise IOError("cabarc failed")
add_data(db, "Media",
[(1, self.index, None, "#"+self.name, None, None)])
add_stream(db, self.name, self.name+".cab")
@@ -672,5 +672,5 @@ def set_arch_from_file(path):
Win64 = 1
arch_ext = '.amd64'
else:
- raise ValueError, "Unsupported architecture"
+ raise ValueError("Unsupported architecture")
msi_type += ";1033"
diff --git a/Tools/scripts/texi2html.py b/Tools/scripts/texi2html.py
index 37d6e91..eae466c 100755
--- a/Tools/scripts/texi2html.py
+++ b/Tools/scripts/texi2html.py
@@ -257,7 +257,7 @@ class TexinfoParser:
line = fp.readline()
lineno = lineno + 1
if line[:len(MAGIC)] <> MAGIC:
- raise SyntaxError, 'file does not begin with %r' % (MAGIC,)
+ raise SyntaxError('file does not begin with %r' % (MAGIC,))
self.parserest(fp, lineno)
# Parse the contents of a file, not expecting a MAGIC header
@@ -475,7 +475,7 @@ class TexinfoParser:
continue
if c <> '@':
# Cannot happen unless spprog is changed
- raise RuntimeError, 'unexpected funny %r' % c
+ raise RuntimeError('unexpected funny %r' % c)
start = i
while i < n and text[i] in string.ascii_letters: i = i+1
if i == start:
diff --git a/Tools/scripts/untabify.py b/Tools/scripts/untabify.py
index 49e9049..1a186a3 100755
--- a/Tools/scripts/untabify.py
+++ b/Tools/scripts/untabify.py
@@ -11,7 +11,7 @@ def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "t:")
if not args:
- raise getopt.error, "At least one file argument required"
+ raise getopt.error("At least one file argument required")
except getopt.error as msg:
print(msg)
print("usage:", sys.argv[0], "[-t tabwidth] file ...")
diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py
index ab08887..3778efa 100644
--- a/Tools/unicode/makeunicodedata.py
+++ b/Tools/unicode/makeunicodedata.py
@@ -138,7 +138,7 @@ def makeunicodedata(unicode, trace):
if record[5]:
decomp = record[5].split()
if len(decomp) > 19:
- raise Exception, "character %x has a decomposition too large for nfd_nfkd" % char
+ raise Exception("character %x has a decomposition too large for nfd_nfkd" % char)
# prefix
if decomp[0][0] == "<":
prefix = decomp.pop(0)
@@ -608,7 +608,7 @@ def makeunicodename(unicode, trace):
def merge_old_version(version, new, old):
# Changes to exclusion file not implemented yet
if old.exclusions != new.exclusions:
- raise NotImplementedError, "exclusions differ"
+ raise NotImplementedError("exclusions differ")
# In these change records, 0xFF means "no change"
bidir_changes = [0xFF]*0x110000
@@ -677,7 +677,7 @@ def merge_old_version(version, new, old):
pass
else:
class Difference(Exception):pass
- raise Difference, (hex(i), k, old.table[i], new.table[i])
+ raise Difference(hex(i), k, old.table[i], new.table[i])
new.changed.append((version, list(zip(bidir_changes, category_changes,
decimal_changes, numeric_changes)),
normalization_changes))
@@ -821,7 +821,7 @@ class Hash:
poly = size + poly
break
else:
- raise AssertionError, "ran out of polynominals"
+ raise AssertionError("ran out of polynominals")
print(size, "slots in hash table")
diff --git a/Tools/unicode/mkstringprep.py b/Tools/unicode/mkstringprep.py
index b910d69..83a5d8f 100644
--- a/Tools/unicode/mkstringprep.py
+++ b/Tools/unicode/mkstringprep.py
@@ -1,7 +1,7 @@
import re, unicodedata, sys
if sys.maxunicode == 65535:
- raise RuntimeError, "need UCS-4 Python"
+ raise RuntimeError("need UCS-4 Python")
def gen_category(cats):
for i in range(0, 0x110000):