================ @@ -103,24 +139,79 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { "Resulting object is not initialized."); std::apply( - [&method, &expected_return_object](auto &&...args) { + [&init, &expected_return_object](auto &&...args) { llvm::consumeError(expected_return_object.takeError()); - expected_return_object = method(args...); + expected_return_object = init(args...); }, transformed_args); - if (llvm::Error e = expected_return_object.takeError()) - return std::move(e); - result = std::move(expected_return_object.get()); + if (!expected_return_object) + return expected_return_object.takeError(); + result = expected_return_object.get(); } - if (!result.IsValid()) + if (!result.IsValid() || !result.HasAttribute("__class__")) + return llvm::createStringError( + llvm::inconvertibleErrorCode(), + "Resulting object is not a valid Python Object."); + + PythonObject obj_class = result.GetAttributeValue("__class__"); + + PythonString obj_class_name = + obj_class.GetAttributeValue("__name__").AsType<PythonString>(); + + PythonObject object_class_mapping_proxy = + obj_class.GetAttributeValue("__dict__"); + + PythonCallable dict_converter = PythonModule::BuiltinsModule() + .ResolveName("dict") + .AsType<PythonCallable>(); + if (!dict_converter.IsAllocated()) + return llvm::createStringError( + llvm::inconvertibleErrorCode(), + "Resulting object is not a valid Python Object."); ---------------- medismailben wrote:
I was planning on updating the error message before making the PR but I forgot 😅 Thanks for catching that! https://github.com/llvm/llvm-project/pull/71260 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits