[pypy-commit] pypy py3k: make sure that we write *bytes* when marshaling; test_load_module_pyc_1 makes a bit of more progress, now it fails because we don't know how to handle _io files

antocuni noreply at buildbot.pypy.org
Mon Feb 27 17:00:36 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r52942:138699bd5038
Date: 2012-02-27 16:57 +0100
http://bitbucket.org/pypy/pypy/changeset/138699bd5038/

Log:	make sure that we write *bytes* when marshaling;
	test_load_module_pyc_1 makes a bit of more progress, now it fails
	because we don't know how to handle _io files

diff --git a/pypy/module/imp/test/test_app.py b/pypy/module/imp/test/test_app.py
--- a/pypy/module/imp/test/test_app.py
+++ b/pypy/module/imp/test/test_app.py
@@ -18,7 +18,7 @@
         co = compile("marker=42", "x.py", "exec")
         f = open('@TEST.pyc', 'wb')
         f.write(imp.get_magic())
-        f.write('\x00\x00\x00\x00')
+        f.write(b'\x00\x00\x00\x00')
         marshal.dump(co, f)
         f.close()
         return '@TEST.pyc'
diff --git a/pypy/module/marshal/interp_marshal.py b/pypy/module/marshal/interp_marshal.py
--- a/pypy/module/marshal/interp_marshal.py
+++ b/pypy/module/marshal/interp_marshal.py
@@ -81,7 +81,7 @@
 
     def write(self, data):
         space = self.space
-        space.call_function(self.func, space.wrap(data))
+        space.call_function(self.func, space.wrapbytes(data))
 
 
 class FileReader(AbstractReaderWriter):


More information about the pypy-commit mailing list