mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-27 15:14:31 +00:00
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:
1 parent
2cab8eec74
commit
a87d0ae61b
3 files changed
+66
No files matched your search
@@ -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