diff options
author | Barry Warsaw <barry@python.org> | 1997-01-14 17:11:02 +0000 |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1997-01-14 17:11:02 +0000 |
commit | 09c2471eb8d0aeb31392d4ae71077ad8b427f968 (patch) | |
tree | 60f9a554ba04358900a169a3919a2cffde83ab21 /Lib | |
parent | 43c27444726b8c761bcc388033da9cf34bad9743 (diff) | |
download | cpython-09c2471eb8d0aeb31392d4ae71077ad8b427f968.tar.gz |
Raise ConversionError instances the new fangled way, e.g.:
raise ConversionError, msg
where `msg' is passed as the argument to the constructor.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/xdrlib.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/xdrlib.py b/Lib/xdrlib.py index 0a9f4646d2..0345704c91 100644 --- a/Lib/xdrlib.py +++ b/Lib/xdrlib.py @@ -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() |