diff options
author | Barry Warsaw <barry@python.org> | 1997-01-14 17:11:02 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1997-01-14 17:11:02 (GMT) |
commit | 7e98bda43b60fc040b5662b53d73ebb18b589a85 (patch) | |
tree | c29894efb6f87a4f5f2a41cc0d14c7aa1934b6ec /Lib | |
parent | 6f72f97c036bcc0779dc597a935b7250c55d1e8d (diff) | |
download | cpython-7e98bda43b60fc040b5662b53d73ebb18b589a85.zip cpython-7e98bda43b60fc040b5662b53d73ebb18b589a85.tar.gz cpython-7e98bda43b60fc040b5662b53d73ebb18b589a85.tar.bz2 |
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 0a9f464..0345704 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() |