lawrence_danna added inline comments.
================
Comment at:
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp:1369
+ const char *utf8 = PyUnicode_AsUTF8AndSize(pystring.get(), &size);
+ if (!utf8 || PyErr_Occurred())
+ return Status(llvm::make_error<PythonException>("Read"));
----------------
labath wrote:
> This is an example where _I think_ you may be using `PyErr_Occurred`
> incorrectly. If python really asserts that PyErr_Occurred is always called,
> then this is not right, as you will not call it if the result is null. There
> are a couple of other examples like that in the code too.
I think it is correct.
Python doesn't assert that PyErr_Occured is called, it asserts that the error
is cleared before you call back in to another thing that can cause an error.
PythonException will clear the error if there is one, or say "unknown error" if
there isn't one (which should never happen if utf8==NULL, but i'm checking out
of abundance of caution)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68188/new/
https://reviews.llvm.org/D68188
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits