From 4902e69e40b7f73bbb5e02a64260a8cf03651c80 Mon Sep 17 00:00:00 2001 From: Collin Winter Date: Thu, 30 Aug 2007 18:18:27 +0000 Subject: More raise statement normalization. --- Demo/scripts/toaiff.py | 8 ++++---- Lib/UserString.py | 4 ++-- Lib/encodings/utf_32.py | 2 +- Parser/asdl.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Demo/scripts/toaiff.py b/Demo/scripts/toaiff.py index 438d225..5794859 100644 --- a/Demo/scripts/toaiff.py +++ b/Demo/scripts/toaiff.py @@ -80,7 +80,7 @@ def _toaiff(filename, temps): temps.append(fname) sts = uncompress.copy(filename, fname) if sts: - raise error, filename + ': uncompress failed' + raise error(filename + ': uncompress failed') else: fname = filename try: @@ -93,15 +93,15 @@ def _toaiff(filename, temps): msg = msg[1] if type(msg) != type(''): msg = repr(msg) - raise error, filename + ': ' + msg + raise error(filename + ': ' + msg) if ftype == 'aiff': return fname if ftype is None or not ftype in table: - raise error, '%s: unsupported audio file type %r' % (filename, ftype) + raise error('%s: unsupported audio file type %r' % (filename, ftype)) (fd, temp) = tempfile.mkstemp() os.close(fd) temps.append(temp) sts = table[ftype].copy(fname, temp) if sts: - raise error, filename + ': conversion to aiff failed' + raise error(filename + ': conversion to aiff failed') return temp diff --git a/Lib/UserString.py b/Lib/UserString.py index c55c1bf..de50396 100755 --- a/Lib/UserString.py +++ b/Lib/UserString.py @@ -197,7 +197,7 @@ class MutableString(UserString): elif step != 1: # XXX(twouters): I guess we should be reimplementing # the extended slice assignment/deletion algorithm here... - raise TypeError, "invalid step in slicing assignment" + raise TypeError("invalid step in slicing assignment") start = min(start, stop) self.data = self.data[:start] + sub + self.data[stop:] else: @@ -212,7 +212,7 @@ class MutableString(UserString): start, stop = stop+1, start+1 elif step != 1: # XXX(twouters): see same block in __setitem__ - raise TypeError, "invalid step in slicing deletion" + raise TypeError("invalid step in slicing deletion") start = min(start, stop) self.data = self.data[:start] + self.data[stop:] else: diff --git a/Lib/encodings/utf_32.py b/Lib/encodings/utf_32.py index 4bbd22a..f0b7709 100644 --- a/Lib/encodings/utf_32.py +++ b/Lib/encodings/utf_32.py @@ -127,7 +127,7 @@ class StreamReader(codecs.StreamReader): elif byteorder == 1: self.decode = codecs.utf_32_be_decode elif consumed>=4: - raise UnicodeError,"UTF-32 stream does not start with BOM" + raise UnicodeError("UTF-32 stream does not start with BOM") return (object, consumed) ### encodings module API diff --git a/Parser/asdl.py b/Parser/asdl.py index a3701e6..8fbd9ec 100644 --- a/Parser/asdl.py +++ b/Parser/asdl.py @@ -103,7 +103,7 @@ class ASDLScanner(spark.GenericScanner, object): def t_default(self, s): r" . +" - raise ValueError, "unmatched input: %r" % s + raise ValueError("unmatched input: %r" % s) class ASDLParser(spark.GenericParser, object): def __init__(self): -- cgit v0.12