Raise ConversionError instances the new fangled way, e.g.:

raise ConversionError, msg

where `msg' is passed as the argument to the constructor.
This commit is contained in:
Barry Warsaw 1997-01-14 17:11:02 +00:00
parent 6f72f97c03
commit 7e98bda43b
1 changed files with 4 additions and 3 deletions

View File

@ -63,12 +63,12 @@ class Packer:
def pack_float(self, x):
try: self.__buf = self.__buf + struct.pack('>f', x)
except struct.error, msg:
raise ConversionError(msg)
raise ConversionError, msg
def pack_double(self, x):
try: self.__buf = self.__buf + struct.pack('>d', x)
except struct.error, msg:
raise ConversionError(msg)
raise ConversionError, msg
def pack_fstring(self, n, s):
if n < 0:
@ -205,7 +205,7 @@ class Unpacker:
x = self.unpack_uint()
if x == 0: break
if x <> 1:
raise ConversionError('0 or 1 expected, got ' + `x`)
raise ConversionError, '0 or 1 expected, got ' + `x`
item = unpack_item()
list.append(item)
return list
@ -274,5 +274,6 @@ def _test():
print 'ConversionError:', var.msg
count = count + 1
if __name__ == '__main__':
_test()