summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-11-13 01:50:19 +0000
committerZachary Turner <zturner@google.com>2015-11-13 01:50:19 +0000
commita87d0ae61b42e06e0b86ac114e3613a9976d2ca0 (patch)
tree57b2eb465a22b565a9c55ea4909f529f50aadd05 /lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp
parent2cab8eec7423e8608f877a98b2a6879dd4fb5b6c (diff)
downloadbcm5719-llvm-a87d0ae61b42e06e0b86ac114e3613a9976d2ca0.tar.gz
bcm5719-llvm-a87d0ae61b42e06e0b86ac114e3613a9976d2ca0.zip
Fix a bug in PythonExceptionState and add unittest coverage.
I forgot to reset the restore flag when calling member function `Acquire`. The newly added unittest should cover this case. llvm-svn: 253002
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp
index 4e3c8002fbf..b66f9a6b891 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp
@@ -50,6 +50,7 @@ PythonExceptionState::Acquire(bool restore_on_exit)
m_type.Reset(PyRefType::Owned, py_type);
m_value.Reset(PyRefType::Owned, py_value);
m_traceback.Reset(PyRefType::Owned, py_traceback);
+ m_restore_on_exit = restore_on_exit;
}
void
@@ -77,6 +78,15 @@ PythonExceptionState::Discard()
m_traceback.Reset();
}
+void
+PythonExceptionState::Reset()
+{
+ if (m_restore_on_exit)
+ Restore();
+ else
+ Discard();
+}
+
bool
PythonExceptionState::HasErrorOccurred()
{
OpenPOWER on IntegriCloud