[pypy-commit] pypy default: promote format on struct.Struct objects

bdkearns noreply at buildbot.pypy.org
Tue May 6 04:11:37 CEST 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r71306:d93da947bbf6
Date: 2014-05-05 18:35 -0400
http://bitbucket.org/pypy/pypy/changeset/d93da947bbf6/

Log:	promote format on struct.Struct objects

diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py b/pypy/module/pypyjit/test_pypy_c/test_struct.py
--- a/pypy/module/pypyjit/test_pypy_c/test_struct.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py
@@ -44,7 +44,6 @@
         """)
 
     def test_struct_object(self):
-        skip("XXX broken")
         def main(n):
             import struct
             s = struct.Struct("i")
diff --git a/pypy/module/struct/interp_struct.py b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -115,18 +115,18 @@
         return self
 
     def descr_pack(self, space, args_w):
-        return pack(space, self.format, args_w)
+        return pack(space, jit.promote_string(self.format), args_w)
 
     @unwrap_spec(offset=int)
     def descr_pack_into(self, space, w_buffer, offset, args_w):
-        return pack_into(space, self.format, w_buffer, offset, args_w)
+        return pack_into(space, jit.promote_string(self.format), w_buffer, offset, args_w)
 
     def descr_unpack(self, space, w_str):
-        return unpack(space, self.format, w_str)
+        return unpack(space, jit.promote_string(self.format), w_str)
 
     @unwrap_spec(offset=int)
     def descr_unpack_from(self, space, w_buffer, offset=0):
-        return unpack_from(space, self.format, w_buffer, offset)
+        return unpack_from(space, jit.promote_string(self.format), w_buffer, offset)
 
 W_Struct.typedef = TypeDef("Struct",
     __new__=interp2app(W_Struct.descr__new__.im_func),


More information about the pypy-commit mailing list