[Lldb-commits] Patch for embedded Python exit()

Caroline Tice ctice at apple.com
Wed Jun 9 13:18:32 PDT 2010


Eventually, hopefully,  we will use the standalone embedded_interpreter.py file; the difficulty we were working
around at the moment was figuring out where/how to reliably put it on our systems to ensure it was really
there when users "installed" the lldb framework library.    To work around that problem temporarily, we 
made a copy of the entire file as a string in ScriptInterpteterPython.cpp.  We should definitely keep the two
in sync.  

Your patch looks good, and I will commit it for you later today.  Thanks!

-- Caroline Tice
ctice at apple.com


On Jun 9, 2010, at 9:32 AM, Joseph Ranieri wrote:

> Attached is a patch that makes the embedded Python interpreter handle the 'exit' method correctly. I have applied the fix to the Python script embedded in ScriptInterpreterPython.cpp and embedded_interpreter.py, but I am not sure if anything actually uses the standalone version.
> 
> 'exit' behaves like 'quit', which was already handled, and will close the stdout file handle if called. This would result in the following workflow generating an endless stream of exceptions:
> (lldb) script
> >>> exit()
> (lldb) script
> >>> Traceback (most recent call last):
>   File "embedded_interpreter.py", line 25, in interact
>     self.read_py_command()
>   File "embedded_interpreter.py", line 77, in read_py_command
>     line = self.my_raw_input(prompt)
>   File "embedded_interpreter.py", line 58, in my_raw_input
>     line = sys.stdin.readline()
> ValueError: I/O operation on closed file
> >>> Traceback (most recent call last):
>   File "embedded_interpreter.py", line 25, in interact
>     self.read_py_command()
>   File "embedded_interpreter.py", line 77, in read_py_command
>     line = self.my_raw_input(prompt)
>   File "embedded_interpreter.py", line 58, in my_raw_input
>     line = sys.stdin.readline()
> ValueError: I/O operation on closed file
> <python_exit.diff>_______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits





More information about the lldb-commits mailing list