[Python-3000-checkins] r57299 - in python/branches/py3k: Tools/bgen/bgen/bgenBuffer.py Tools/bgen/bgen/bgenGenerator.py Tools/bgen/bgen/bgenHeapBuffer.py Tools/bgen/bgen/bgenOutput.py Tools/bgen/bgen/bgenType.py Tools/bgen/bgen/scantools.py Tools/framer/framer/struct.py Tools/freeze/winmakemakefile.py Tools/modulator/genmodule.py Tools/modulator/varsubst.py Tools/msi/msi.py Tools/msi/msilib.py Tools/scripts/texi2html.py Tools/scripts/untabify.py Tools/unicode/makeunicodedata.py Tools/unicode/mkstringprep.py
collin.winter
python-3000-checkins at python.org
Thu Aug 23 01:05:07 CEST 2007
Author: collin.winter
Date: Thu Aug 23 01:05:06 2007
New Revision: 57299
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Tools/bgen/bgen/bgenBuffer.py
python/branches/py3k/Tools/bgen/bgen/bgenGenerator.py
python/branches/py3k/Tools/bgen/bgen/bgenHeapBuffer.py
python/branches/py3k/Tools/bgen/bgen/bgenOutput.py
python/branches/py3k/Tools/bgen/bgen/bgenType.py
python/branches/py3k/Tools/bgen/bgen/scantools.py
python/branches/py3k/Tools/framer/framer/struct.py
python/branches/py3k/Tools/freeze/winmakemakefile.py
python/branches/py3k/Tools/modulator/genmodule.py
python/branches/py3k/Tools/modulator/varsubst.py
python/branches/py3k/Tools/msi/msi.py
python/branches/py3k/Tools/msi/msilib.py
python/branches/py3k/Tools/scripts/texi2html.py
python/branches/py3k/Tools/scripts/untabify.py
python/branches/py3k/Tools/unicode/makeunicodedata.py
python/branches/py3k/Tools/unicode/mkstringprep.py
Log:
Convert raise statements in Tools/.
Modified: python/branches/py3k/Tools/bgen/bgen/bgenBuffer.py
==============================================================================
--- python/branches/py3k/Tools/bgen/bgen/bgenBuffer.py (original)
+++ python/branches/py3k/Tools/bgen/bgen/bgenBuffer.py Thu Aug 23 01:05:06 2007
@@ -40,7 +40,7 @@
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 @@
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 @@
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:
Modified: python/branches/py3k/Tools/bgen/bgen/bgenGenerator.py
==============================================================================
--- python/branches/py3k/Tools/bgen/bgen/bgenGenerator.py (original)
+++ python/branches/py3k/Tools/bgen/bgen/bgenGenerator.py Thu Aug 23 01:05:06 2007
@@ -280,7 +280,7 @@
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)
Modified: python/branches/py3k/Tools/bgen/bgen/bgenHeapBuffer.py
==============================================================================
--- python/branches/py3k/Tools/bgen/bgen/bgenHeapBuffer.py (original)
+++ python/branches/py3k/Tools/bgen/bgen/bgenHeapBuffer.py Thu Aug 23 01:05:06 2007
@@ -18,7 +18,7 @@
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:
Modified: python/branches/py3k/Tools/bgen/bgen/bgenOutput.py
==============================================================================
--- python/branches/py3k/Tools/bgen/bgen/bgenOutput.py (original)
+++ python/branches/py3k/Tools/bgen/bgen/bgenOutput.py Thu Aug 23 01:05:06 2007
@@ -83,7 +83,7 @@
"""
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):
Modified: python/branches/py3k/Tools/bgen/bgen/bgenType.py
==============================================================================
--- python/branches/py3k/Tools/bgen/bgen/bgenType.py (original)
+++ python/branches/py3k/Tools/bgen/bgen/bgenType.py Thu Aug 23 01:05:06 2007
@@ -163,7 +163,7 @@
"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 @@
"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):
Modified: python/branches/py3k/Tools/bgen/bgen/scantools.py
==============================================================================
--- python/branches/py3k/Tools/bgen/bgen/scantools.py (original)
+++ python/branches/py3k/Tools/bgen/bgen/scantools.py Thu Aug 23 01:05:06 2007
@@ -420,7 +420,7 @@
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 @@
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():
Modified: python/branches/py3k/Tools/framer/framer/struct.py
==============================================================================
--- python/branches/py3k/Tools/framer/framer/struct.py (original)
+++ python/branches/py3k/Tools/framer/framer/struct.py Thu Aug 23 01:05:06 2007
@@ -17,7 +17,7 @@
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.
Modified: python/branches/py3k/Tools/freeze/winmakemakefile.py
==============================================================================
--- python/branches/py3k/Tools/freeze/winmakemakefile.py (original)
+++ python/branches/py3k/Tools/freeze/winmakemakefile.py Thu Aug 23 01:05:06 2007
@@ -39,7 +39,7 @@
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):
Modified: python/branches/py3k/Tools/modulator/genmodule.py
==============================================================================
--- python/branches/py3k/Tools/modulator/genmodule.py (original)
+++ python/branches/py3k/Tools/modulator/genmodule.py Thu Aug 23 01:05:06 2007
@@ -63,8 +63,8 @@
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'
Modified: python/branches/py3k/Tools/modulator/varsubst.py
==============================================================================
--- python/branches/py3k/Tools/modulator/varsubst.py (original)
+++ python/branches/py3k/Tools/modulator/varsubst.py Thu Aug 23 01:05:06 2007
@@ -29,7 +29,7 @@
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)
Modified: python/branches/py3k/Tools/msi/msi.py
==============================================================================
--- python/branches/py3k/Tools/msi/msi.py (original)
+++ python/branches/py3k/Tools/msi/msi.py Thu Aug 23 01:05:06 2007
@@ -157,7 +157,7 @@
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'
Modified: python/branches/py3k/Tools/msi/msilib.py
==============================================================================
--- python/branches/py3k/Tools/msi/msilib.py (original)
+++ python/branches/py3k/Tools/msi/msilib.py Thu Aug 23 01:05:06 2007
@@ -254,7 +254,7 @@
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 @@
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 @@
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 @@
Win64 = 1
arch_ext = '.amd64'
else:
- raise ValueError, "Unsupported architecture"
+ raise ValueError("Unsupported architecture")
msi_type += ";1033"
Modified: python/branches/py3k/Tools/scripts/texi2html.py
==============================================================================
--- python/branches/py3k/Tools/scripts/texi2html.py (original)
+++ python/branches/py3k/Tools/scripts/texi2html.py Thu Aug 23 01:05:06 2007
@@ -257,7 +257,7 @@
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 @@
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:
Modified: python/branches/py3k/Tools/scripts/untabify.py
==============================================================================
--- python/branches/py3k/Tools/scripts/untabify.py (original)
+++ python/branches/py3k/Tools/scripts/untabify.py Thu Aug 23 01:05:06 2007
@@ -11,7 +11,7 @@
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 ...")
Modified: python/branches/py3k/Tools/unicode/makeunicodedata.py
==============================================================================
--- python/branches/py3k/Tools/unicode/makeunicodedata.py (original)
+++ python/branches/py3k/Tools/unicode/makeunicodedata.py Thu Aug 23 01:05:06 2007
@@ -138,7 +138,7 @@
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 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 @@
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 @@
poly = size + poly
break
else:
- raise AssertionError, "ran out of polynominals"
+ raise AssertionError("ran out of polynominals")
print(size, "slots in hash table")
Modified: python/branches/py3k/Tools/unicode/mkstringprep.py
==============================================================================
--- python/branches/py3k/Tools/unicode/mkstringprep.py (original)
+++ python/branches/py3k/Tools/unicode/mkstringprep.py Thu Aug 23 01:05:06 2007
@@ -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):
More information about the Python-3000-checkins
mailing list