[pypy-svn] r46389 - in pypy/dist/pypy/translator/sandbox: . test

arigo at codespeak.net arigo at codespeak.net
Fri Sep 7 12:04:33 CEST 2007


Author: arigo
Date: Fri Sep  7 12:04:32 2007
New Revision: 46389

Modified:
   pypy/dist/pypy/translator/sandbox/sandlib.py
   pypy/dist/pypy/translator/sandbox/test/test_sandbox.py
Log:
Move the flush() out of write_message() because we often write
two messages at once.


Modified: pypy/dist/pypy/translator/sandbox/sandlib.py
==============================================================================
--- pypy/dist/pypy/translator/sandbox/sandlib.py	(original)
+++ pypy/dist/pypy/translator/sandbox/sandlib.py	Fri Sep  7 12:04:32 2007
@@ -45,7 +45,6 @@
         buf = []
         get_marshaller(resulttype)(buf, msg)
         g.write(''.join(buf))
-    g.flush()
 
 # keep the table in sync with rsandbox.reraise_error()
 EXCEPTION_TABLE = [
@@ -69,6 +68,7 @@
                 if error is None:
                     error = errno.EPERM
                 write_message(g, error)
+            g.flush()
             break
     else:
         # just re-raise the exception
@@ -154,6 +154,7 @@
                     log.result(shortrepr(answer))
                 write_message(self.popen.stdin, 0)  # error code - 0 for ok
                 write_message(self.popen.stdin, answer, resulttype)
+                self.popen.stdin.flush()
         returncode = self.popen.wait()
         return returncode
 

Modified: pypy/dist/pypy/translator/sandbox/test/test_sandbox.py
==============================================================================
--- pypy/dist/pypy/translator/sandbox/test/test_sandbox.py	(original)
+++ pypy/dist/pypy/translator/sandbox/test/test_sandbox.py	Fri Sep  7 12:04:32 2007
@@ -17,6 +17,7 @@
     else:
         write_message(g, 0)
         write_message(g, result, resulttype)
+        g.flush()
 
 
 def test_open_dup():



More information about the Pypy-commit mailing list