cpython: bd5e821f201c (original) (raw)
Mercurial > cpython
changeset 69012:bd5e821f201c 3.1
Issue #9696: Fix exception incorrectly raised by xdrlib.Packer.pack_int when trying to pack a negative (in-range) integer. [#9696]
Mark Dickinson mdickinson@enthought.com | |
---|---|
date | Sun, 27 Mar 2011 16:25:40 +0100 |
parents | 15945b28f761 |
children | 391b2ddbc1b7 f3d96d28a86e |
files | Lib/test/test_xdrlib.py Lib/xdrlib.py Misc/ACKS Misc/NEWS |
diffstat | 4 files changed, 9 insertions(+), 1 deletions(-)[+] [-] Lib/test/test_xdrlib.py 2 Lib/xdrlib.py 4 Misc/ACKS 1 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/test/test_xdrlib.py +++ b/Lib/test/test_xdrlib.py @@ -12,6 +12,7 @@ class XDRTest(unittest.TestCase): a = [b'what', b'is', b'hapnin', b'doctor'] p.pack_int(42)
p.pack_int(-17)[](#l1.7) p.pack_uint(9)[](#l1.8) p.pack_bool(True)[](#l1.9) p.pack_bool(False)[](#l1.10)
@@ -29,6 +30,7 @@ class XDRTest(unittest.TestCase): self.assertEqual(up.get_position(), 0) self.assertEqual(up.unpack_int(), 42)
self.assertEqual(up.unpack_int(), -17)[](#l1.15) self.assertEqual(up.unpack_uint(), 9)[](#l1.16) self.assertTrue(up.unpack_bool() is True)[](#l1.17)
--- a/Lib/xdrlib.py +++ b/Lib/xdrlib.py @@ -50,7 +50,9 @@ class Packer: def pack_uint(self, x): self.__buf.write(struct.pack('>L', x))
+ pack_enum = pack_int def pack_bool(self, x):
--- a/Misc/ACKS +++ b/Misc/ACKS @@ -303,6 +303,7 @@ Eddy De Greef Duncan Grisby Fabian Groffen Dag Gruneau +Filip Gruszczyński Michael Guravage Lars Gustäbel Thomas Güttler
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -44,6 +44,9 @@ Core and Builtins Library ------- +- Issue #9696: Fix exception incorrectly raised by xdrlib.Packer.pack_int when