[Python-checkins] cpython (merge default -> default): merge

mark.dickinson python-checkins at python.org
Sun Mar 27 17:40:06 CEST 2011


http://hg.python.org/cpython/rev/34adc0b917d0
changeset:   69015:34adc0b917d0
parent:      69011:cae30f34bd16
parent:      69014:d9b64a86d5a7
user:        Mark Dickinson <mdickinson at enthought.com>
date:        Sun Mar 27 16:39:53 2011 +0100
summary:
  merge

files:
  Lib/test/test_xdrlib.py |  2 ++
  Lib/xdrlib.py           |  4 +++-
  Misc/NEWS               |  3 +++
  3 files changed, 8 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_xdrlib.py b/Lib/test/test_xdrlib.py
--- a/Lib/test/test_xdrlib.py
+++ b/Lib/test/test_xdrlib.py
@@ -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 --git a/Lib/xdrlib.py b/Lib/xdrlib.py
--- a/Lib/xdrlib.py
+++ b/Lib/xdrlib.py
@@ -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 --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -89,6 +89,9 @@
 
 - Issue #11692: Remove unnecessary demo functions in subprocess module.
 
+- 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.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list