[Lldb-commits] [lldb] [lldb/Interpreter] Introduce `ScriptedStopHook{, Python}Interface` & make use of it (PR #105449)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 20 17:56:05 PDT 2024
================
@@ -137,12 +137,28 @@ class ScriptedPythonInterface : virtual public ScriptedInterface {
llvm::Expected<PythonObject> expected_return_object =
create_error("Resulting object is not initialized.");
- std::apply(
- [&init, &expected_return_object](auto &&...args) {
- llvm::consumeError(expected_return_object.takeError());
- expected_return_object = init(args...);
- },
- transformed_args);
+ size_t num_args = sizeof...(Args);
+ if (num_args != arg_info->max_positional_args) {
+ if (num_args != arg_info->max_positional_args - 1)
+ return create_error(
+ llvm::formatv("Passed arguments ({0}) doesn't match the number "
+ "of expected arguments ({1}).",
+ num_args, arg_info->max_positional_args));
+
+ std::apply(
+ [&init, &expected_return_object](auto &&...args) {
+ llvm::consumeError(expected_return_object.takeError());
+ expected_return_object = init(args...);
+ },
+ std::tuple_cat(transformed_args, std::make_tuple(dict)));
+ } else {
+ std::apply(
+ [&init, &expected_return_object](auto &&...args) {
+ llvm::consumeError(expected_return_object.takeError());
+ expected_return_object = init(args...);
+ },
+ transformed_args);
+ }
----------------
JDevlieghere wrote:
Your commit message explains it, but I think this deserves a comment here as well.
https://github.com/llvm/llvm-project/pull/105449
More information about the lldb-commits
mailing list