[pypy-svn] r66305 - in pypy/branch/parser-compiler/pypy/interpreter/astcompiler: . test
benjamin at codespeak.net
benjamin at codespeak.net
Fri Jul 17 15:37:08 CEST 2009
Author: benjamin
Date: Fri Jul 17 15:37:07 2009
New Revision: 66305
Modified:
pypy/branch/parser-compiler/pypy/interpreter/astcompiler/codegen.py
pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_compiler.py
Log:
fix a subtle bug in the print statement
Modified: pypy/branch/parser-compiler/pypy/interpreter/astcompiler/codegen.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/astcompiler/codegen.py (original)
+++ pypy/branch/parser-compiler/pypy/interpreter/astcompiler/codegen.py Fri Jul 17 15:37:07 2009
@@ -350,7 +350,7 @@
self.emit_op(ops.PRINT_NEWLINE_TO)
else:
self.emit_op(ops.PRINT_NEWLINE)
- if have_dest:
+ elif have_dest:
self.emit_op(ops.POP_TOP)
def visit_Delete(self, delete):
Modified: pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_compiler.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_compiler.py (original)
+++ pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_compiler.py Fri Jul 17 15:37:07 2009
@@ -694,3 +694,15 @@
l.append(x)
"""
self.simple_test(source, 'l', [1, 2])
+
+
+class AppTestPrint:
+
+ def test_print_to(self):
+ exec """from StringIO import StringIO
+s = StringIO()
+print >> s, "hi", "lovely!"
+assert s.getvalue() == "hi lovely!\\n"
+s = StringIO()
+print >> s, "hi", "lovely!",
+assert s.getvalue() == "hi lovely!\"""" in {}
More information about the Pypy-commit
mailing list