[Lldb-commits] [PATCH] D78462: get rid of PythonInteger::GetInteger()

Lawrence D'Anna via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 21 17:21:10 PDT 2020


lawrence_danna added inline comments.


================
Comment at: lldb/bindings/python/python-wrapper.swig:585-597
+    llvm::Expected<PythonObject> result = pfunc.Call(PythonString(child_name));
 
-    if (!result.IsAllocated())
-        return UINT32_MAX;
+    long long retval = unwrapOrSetPythonException(As<long long>(std::move(result)));
 
-    PythonInteger int_result = result.AsType<PythonInteger>();
-    if (!int_result.IsAllocated())
+    if (PyErr_Occurred()) { 
+        PyErr_Clear(); // FIXME print this? do something else
         return UINT32_MAX;
----------------
labath wrote:
> If you don't print this, then you could definitely do something like:
> ```
> Expected<long long> result = As<long long>(pfunc.Call(PythonString(child_name));
> if (result)
>   return std::max<long long>(*result, 0);
> consumeError(result.takeError());
> return UINT32_MAX;
> ```
aparently this function is not even used... I'll put up a new diff to remove it


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78462





More information about the lldb-commits mailing list