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
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user