diff options
author | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-10-16 01:58:15 +0000 |
---|---|---|
committer | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-10-16 01:58:15 +0000 |
commit | b07823f3e2da9b1c6f1866bf1725cfff5eea5b48 (patch) | |
tree | 95250eceb57a07459348d7d6f3e4aa4231c7b6c7 /lldb/packages/Python/lldbsuite/test | |
parent | 9d10b9d99b4d93114eb5d879878fcbb70f2d5b75 (diff) | |
download | bcm5719-llvm-b07823f3e2da9b1c6f1866bf1725cfff5eea5b48.tar.gz bcm5719-llvm-b07823f3e2da9b1c6f1866bf1725cfff5eea5b48.zip |
update ScriptInterpreterPython to use File, not FILE*
Summary:
ScriptInterpreterPython needs to save and restore sys.stdout and
friends when LLDB runs a python script.
It currently does this using FILE*, which is not optimal. If
whatever was in sys.stdout can not be represented as a FILE*, then
it will not be restored correctly when the script is finished.
It also means that if the debugger's own output stream is not
representable as a file, ScriptInterpreterPython will not be able
to redirect python's output correctly.
This patch updates ScriptInterpreterPython to represent files with
lldb_private::File, and to represent whatever the user had in
sys.stdout as simply a PythonObject.
This will make lldb interoperate better with other scripts or programs
that need to manipulate sys.stdout.
Reviewers: JDevlieghere, jasonmolenda, labath
Reviewed By: labath
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D68962
llvm-svn: 374964
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py b/lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py index 6b17b07218c..5a75187262a 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py @@ -445,9 +445,8 @@ class FileHandleTestCase(lldbtest.TestBase): self.assertTrue(re.search(r'error:.*lolwut', errors)) self.assertTrue(re.search(r'zork', errors)) - #FIXME This shouldn't fail for python2 either. + @add_test_categories(['pyapi']) - @skipIf(py_version=['<', (3,)]) def test_replace_stdout(self): f = io.StringIO() with replace_stdout(f): @@ -458,7 +457,6 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) - @expectedFailureAll() #FIXME bug in ScriptInterpreterPython def test_replace_stdout_with_nonfile(self): debugger = self.debugger f = io.StringIO() |