[Lldb-commits] [PATCH] D68188: allow arbitrary python streams to be converted to SBFile

Lawrence D'Anna via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 9 09:40:55 PDT 2019


lawrence_danna marked an inline comment as done.
lawrence_danna added inline comments.


================
Comment at: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp:1258-1265
+  // you must check PyErr_Occurred() after calling this constructor.
+  PythonBuffer(PythonObject &obj, int flags = PyBUF_SIMPLE)
+      : m_buffer({}), m_error(Error::success()) {
+    PyObject_GetBuffer(obj.get(), &m_buffer, flags);
+    if (!m_buffer.obj) {
+      m_error = llvm::make_error<PythonException>();
+    }
----------------
labath wrote:
> Storing the Error as a member is quite unusual. It would be better to have a factory function which returns Expected<PythonBuffer>.
Oh yea I’ll fix that


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68188/new/

https://reviews.llvm.org/D68188





More information about the lldb-commits mailing list