Author: Pawe&#322; Piotr Przeradowski <przeradow...@gmail.com>
Branch: pythoninspect-fix
Changeset: r65668:c1575d6e1de5
Date: 2013-07-25 15:45 +0200
http://bitbucket.org/pypy/pypy/changeset/c1575d6e1de5/

Log:    use __pypy__.os

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -460,11 +460,8 @@
         if os.getenv('PYTHONVERBOSE'):
             options["verbose"] = 1
 
-    # skip environment cache since PYTHONINSPECT could be set in same process
-    from __pypy__.os import real_getenv
-
     if (options["interactive"] or
-        (not options["ignore_environment"] and real_getenv('PYTHONINSPECT'))):
+        (not options["ignore_environment"] and os.getenv('PYTHONINSPECT'))):
         options["inspect"] = 1
 
 ##    We don't print the warning, because it offers no additional security
@@ -559,8 +556,15 @@
         # or
         #     * PYTHONINSPECT is set and stdin is a tty.
         #
+        try:
+            # we need a version of getenv that bypasses Python caching
+            from __pypy__.os import real_getenv
+        except ImportError:
+            # dont fail on CPython here
+            real_getenv = os.getenv
+
         return (interactive or
-                ((inspect or (readenv and os.getenv('PYTHONINSPECT')))
+                ((inspect or (readenv and real_getenv('PYTHONINSPECT')))
                  and sys.stdin.isatty()))
 
     success = True
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to