diff options
author | Mark Dickinson <mdickinson@enthought.com> | 2011-03-27 15:39:53 (GMT) |
---|---|---|
committer | Mark Dickinson <mdickinson@enthought.com> | 2011-03-27 15:39:53 (GMT) |
commit | ad64127878d4c00673a51a3fe5b7cbf7cd33fc19 (patch) | |
tree | 23241fe2d62f9d6d0bbb3dcfda4fb1f8ed1acf03 /Lib | |
parent | f382ab25caeca70fe6814821160651511c0f420d (diff) | |
parent | 574980e946bf6793dc9a1b68f6ed3084fd4d83f1 (diff) | |
download | cpython-ad64127878d4c00673a51a3fe5b7cbf7cd33fc19.zip cpython-ad64127878d4c00673a51a3fe5b7cbf7cd33fc19.tar.gz cpython-ad64127878d4c00673a51a3fe5b7cbf7cd33fc19.tar.bz2 |
merge
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_xdrlib.py | 2 | ||||
-rw-r--r-- | Lib/xdrlib.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_xdrlib.py b/Lib/test/test_xdrlib.py index 073448c..6004c9f 100644 --- 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) p.pack_uint(9) p.pack_bool(True) p.pack_bool(False) @@ -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) self.assertEqual(up.unpack_uint(), 9) self.assertTrue(up.unpack_bool() is True) diff --git a/Lib/xdrlib.py b/Lib/xdrlib.py index b293e06..4e48677 100644 --- 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_int = pack_uint + def pack_int(self, x): + self.__buf.write(struct.pack('>l', x)) + pack_enum = pack_int def pack_bool(self, x): |