[pypy-commit] pypy s390x-backend: endian test issue marshal, test decoded value using platform endianess (not desired for marshall module)

plan_rich pypy.commits at gmail.com
Fri Jan 22 04:00:18 EST 2016


Author: Richard Plangger <planrichi at gmail.com>
Branch: s390x-backend
Changeset: r81907:359e329036d5
Date: 2016-01-22 09:59 +0100
http://bitbucket.org/pypy/pypy/changeset/359e329036d5/

Log:	endian test issue marshal, test decoded value using platform
	endianess (not desired for marshall module)

diff --git a/pypy/module/marshal/test/test_marshalimpl.py b/pypy/module/marshal/test/test_marshalimpl.py
--- a/pypy/module/marshal/test/test_marshalimpl.py
+++ b/pypy/module/marshal/test/test_marshalimpl.py
@@ -64,14 +64,17 @@
     import marshal, struct
 
     class FakeM:
+        # NOTE: marshal is platform independent, running this test must assume
+        # that seen gets values from the endianess of the marshal module.
+        # (which is little endian!)
         def __init__(self):
             self.seen = []
         def start(self, code):
             self.seen.append(code)
         def put_int(self, value):
-            self.seen.append(struct.pack("i", value))
+            self.seen.append(struct.pack("<i", value))
         def put_short(self, value):
-            self.seen.append(struct.pack("h", value))
+            self.seen.append(struct.pack("<h", value))
 
     def _marshal_check(x):
         expected = marshal.dumps(long(x))


More information about the pypy-commit mailing list