[Lldb-commits] [lldb] r110731 - /lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Johnny Chen johnny.chen at apple.com
Tue Aug 10 14:26:55 PDT 2010


Author: johnny
Date: Tue Aug 10 16:26:55 2010
New Revision: 110731

URL: http://llvm.org/viewvc/llvm-project?rev=110731&view=rev
Log:
There is no need to restore (sys.stdin, sys.stdout) of the python script
interpreter right before calling Py_Finalize().  This also fixed the crash as
reported in rdar://problem/8252903.

Modified:
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=110731&r1=110730&r2=110731&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Tue Aug 10 16:26:55 2010
@@ -211,15 +211,12 @@
         PyRun_SimpleString ("from embedded_interpreter import run_python_interpreter");
         PyRun_SimpleString ("import sys");
         PyRun_SimpleString ("from termios import *");
-        PyRun_SimpleString ("old_stdin = sys.stdin");
       
         StreamString run_string;
         run_string.Printf ("new_stdin = open('%s', 'r')", pty_slave_name);
         PyRun_SimpleString (run_string.GetData());
         PyRun_SimpleString ("sys.stdin = new_stdin");
 
-        PyRun_SimpleString ("old_stdout = sys.stdout");
-        
         if (out_fh != NULL)
         {
             PyObject *new_sysout = PyFile_FromFile (out_fh, (char *) "", (char *) "w", 
@@ -253,8 +250,6 @@
 
 ScriptInterpreterPython::~ScriptInterpreterPython ()
 {
-    PyRun_SimpleString ("sys.stdin = old_stdin");
-    PyRun_SimpleString ("sys.stdout = old_stdout");
     Py_Finalize ();
 }
 





More information about the lldb-commits mailing list