exception handling in PythonDataObjects.
authorLawrence D'Anna <lawrence_danna@apple.com>
Tue, 8 Oct 2019 17:56:18 +0000 (17:56 +0000)
committerLawrence D'Anna <lawrence_danna@apple.com>
Tue, 8 Oct 2019 17:56:18 +0000 (17:56 +0000)
commit085328eeeeba63ab3ef2d59f1bb8fa83ca069d33
tree17fcc488426f35782d7561ace77446e1845f84e9
parent70d2e5427ed31889456fac933c3e596b4bb5a762
exception handling in PythonDataObjects.

Summary:
Python APIs nearly all can return an exception.   They do this
by returning NULL, or -1, or some such value and setting
the exception state with PyErr_Set*().   Exceptions must be
handled before further python API functions are called.   Failure
to do so will result in asserts on debug builds of python.
It will also sometimes, but not usually result in crashes of
release builds.

Nearly everything in PythonDataObjects.h needs to be updated
to account for this.   This patch doesn't fix everything,
but it does introduce some new methods using Expected<>
return types that are safe to use.

split off from https://reviews.llvm.org/D68188

Reviewers: JDevlieghere, jasonmolenda, labath, zturner

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68547

llvm-svn: 374094
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h