[pypy-commit] pypy space-newtext: test and fix

arigo pypy.commits at gmail.com
Wed Feb 15 02:31:54 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: space-newtext
Changeset: r90135:292e20099929
Date: 2017-02-15 08:31 +0100
http://bitbucket.org/pypy/pypy/changeset/292e20099929/

Log:	test and fix

diff --git a/pypy/module/struct/formatiterator.py b/pypy/module/struct/formatiterator.py
--- a/pypy/module/struct/formatiterator.py
+++ b/pypy/module/struct/formatiterator.py
@@ -165,6 +165,8 @@
                 w_value = self.space.newint(intmask(value))
             else:
                 w_value = self.space.newint(value)
+        elif isinstance(value, bool):
+            w_value = self.space.newbool(value)
         elif isinstance(value, int):
             w_value = self.space.newint(value)
         elif isinstance(value, float):
diff --git a/pypy/module/struct/test/test_struct.py b/pypy/module/struct/test/test_struct.py
--- a/pypy/module/struct/test/test_struct.py
+++ b/pypy/module/struct/test/test_struct.py
@@ -283,6 +283,7 @@
         assert pack(">?", False) == '\x00'
         assert pack("@?", True) == '\x01'
         assert pack("@?", False) == '\x00'
+        assert self.struct.unpack("?", 'X')[0] is True
 
     def test_transitiveness(self):
         c = 'a'


More information about the pypy-commit mailing list