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

Joseph Ranieri joe at alacatialabs.com
Wed Jun 9 09:32:26 PDT 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20100609/25295a54/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: python_exit.diff
Type: application/octet-stream
Size: 1384 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20100609/25295a54/attachment.obj>


More information about the lldb-commits mailing list