[Python-3000-checkins] r57749 - in python/branches/py3k: Demo/scripts/toaiff.py Lib/UserString.py Lib/encodings/utf_32.py Parser/asdl.py

collin.winter python-3000-checkins at python.org
Thu Aug 30 20:18:27 CEST 2007


Author: collin.winter
Date: Thu Aug 30 20:18:27 2007
New Revision: 57749

Modified:
   python/branches/py3k/Demo/scripts/toaiff.py
   python/branches/py3k/Lib/UserString.py
   python/branches/py3k/Lib/encodings/utf_32.py
   python/branches/py3k/Parser/asdl.py
Log:
More raise statement normalization.

Modified: python/branches/py3k/Demo/scripts/toaiff.py
==============================================================================
--- python/branches/py3k/Demo/scripts/toaiff.py	(original)
+++ python/branches/py3k/Demo/scripts/toaiff.py	Thu Aug 30 20:18:27 2007
@@ -80,7 +80,7 @@
         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 @@
             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

Modified: python/branches/py3k/Lib/UserString.py
==============================================================================
--- python/branches/py3k/Lib/UserString.py	(original)
+++ python/branches/py3k/Lib/UserString.py	Thu Aug 30 20:18:27 2007
@@ -197,7 +197,7 @@
             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 @@
                 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:

Modified: python/branches/py3k/Lib/encodings/utf_32.py
==============================================================================
--- python/branches/py3k/Lib/encodings/utf_32.py	(original)
+++ python/branches/py3k/Lib/encodings/utf_32.py	Thu Aug 30 20:18:27 2007
@@ -127,7 +127,7 @@
         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

Modified: python/branches/py3k/Parser/asdl.py
==============================================================================
--- python/branches/py3k/Parser/asdl.py	(original)
+++ python/branches/py3k/Parser/asdl.py	Thu Aug 30 20:18:27 2007
@@ -103,7 +103,7 @@
 
     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):


More information about the Python-3000-checkins mailing list