(original) (raw)
changeset: 69012:bd5e821f201c branch: 3.1 parent: 69007:15945b28f761 user: Mark Dickinson mdickinson@enthought.com date: Sun Mar 27 16:25:40 2011 +0100 files: Lib/test/test_xdrlib.py Lib/xdrlib.py Misc/ACKS Misc/NEWS description: Issue #9696: Fix exception incorrectly raised by xdrlib.Packer.pack_int when trying to pack a negative (in-range) integer. diff -r 15945b28f761 -r bd5e821f201c Lib/test/test_xdrlib.py --- a/Lib/test/test_xdrlib.py Sun Mar 27 15:46:32 2011 +0100 +++ b/Lib/test/test_xdrlib.py Sun Mar 27 16:25:40 2011 +0100 @@ -12,6 +12,7 @@ a = [b'what', b'is', b'hapnin', b'doctor'] p.pack_int(42) + p.pack_int(-17) p.pack_uint(9) p.pack_bool(True) p.pack_bool(False) @@ -29,6 +30,7 @@ self.assertEqual(up.get_position(), 0) self.assertEqual(up.unpack_int(), 42) + self.assertEqual(up.unpack_int(), -17) self.assertEqual(up.unpack_uint(), 9) self.assertTrue(up.unpack_bool() is True) diff -r 15945b28f761 -r bd5e821f201c Lib/xdrlib.py --- a/Lib/xdrlib.py Sun Mar 27 15:46:32 2011 +0100 +++ b/Lib/xdrlib.py Sun Mar 27 16:25:40 2011 +0100 @@ -50,7 +50,9 @@ def pack_uint(self, x): self.__buf.write(struct.pack('>L', x)) - pack_int = pack_uint + def pack_int(self, x): + self.__buf.write(struct.pack('>l', x)) + pack_enum = pack_int def pack_bool(self, x): diff -r 15945b28f761 -r bd5e821f201c Misc/ACKS --- a/Misc/ACKS Sun Mar 27 15:46:32 2011 +0100 +++ b/Misc/ACKS Sun Mar 27 16:25:40 2011 +0100 @@ -303,6 +303,7 @@ Duncan Grisby Fabian Groffen Dag Gruneau +Filip Gruszczyński Michael Guravage Lars Gustäbel Thomas Güttler diff -r 15945b28f761 -r bd5e821f201c Misc/NEWS --- a/Misc/NEWS Sun Mar 27 15:46:32 2011 +0100 +++ b/Misc/NEWS Sun Mar 27 16:25:40 2011 +0100 @@ -44,6 +44,9 @@ Library ------- +- Issue #9696: Fix exception incorrectly raised by xdrlib.Packer.pack_int when + trying to pack a negative (in-range) integer. + - Issue #11675: multiprocessing.[Raw]Array objects created from an integer size are now zeroed on creation. This matches the behaviour specified by the documentation. /mdickinson@enthought.com