Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r63301:6402218c0442
Date: 2013-04-12 16:11 -0700
http://bitbucket.org/pypy/pypy/changeset/6402218c0442/

Log:    explicitly flush here because stdout is not always line buffered

diff --git a/pypy/module/cpyext/test/test_pyfile.py 
b/pypy/module/cpyext/test/test_pyfile.py
--- a/pypy/module/cpyext/test/test_pyfile.py
+++ b/pypy/module/cpyext/test/test_pyfile.py
@@ -65,11 +65,10 @@
         api.PyFile_SetBufSize()
 
     def test_file_writestring(self, space, api, capfd):
-        s = rffi.str2charp("test\n")
-        try:
-            api.PyFile_WriteString(s, space.sys.get("stdout"))
-        finally:
-            rffi.free_charp(s)
+        w_stdout = space.sys.get("stdout")
+        with rffi.scoped_str2charp("test\n") as s:
+            api.PyFile_WriteString(s, w_stdout)
+        space.call_method(w_stdout, "flush")
         out, err = capfd.readouterr()
         out = out.replace('\r\n', '\n')
         assert out == "test\n"
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to