Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r55479:515924da5e05
Date: 2012-06-07 15:44 +0200
http://bitbucket.org/pypy/pypy/changeset/515924da5e05/

Log:    try to simulate the very same conditions we get when running
        app_main on pypy: in particular, there are no sys.std{in,out,err}
        yet

diff --git a/pypy/translator/goal/app_main.py b/pypy/translator/goal/app_main.py
--- a/pypy/translator/goal/app_main.py
+++ b/pypy/translator/goal/app_main.py
@@ -815,11 +815,15 @@
     old_argv = sys.argv
     old_path = sys.path
 
+    old_streams = sys.stdin, sys.stdout, sys.stderr
+    del sys.stdin, sys.stdout, sys.stderr
+
     try:
         sys.exit(int(entry_point(sys.argv[0], sys.argv[1:], os)))
     finally:
         # restore the normal prompt (which was changed by _pypy_interact), in
         # case we are dropping to CPython's prompt
+        sys.stdin, sys.stdout, sys.stderr = old_streams
         sys.ps1 = '>>> '
         sys.ps2 = '... '
         import os; os.environ.update(reset)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to