[pypy-commit] pypy py3k: 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
antocuni
noreply at buildbot.pypy.org
Thu Jun 7 22:10:03 CEST 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
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)
More information about the pypy-commit
mailing list