[Lldb-commits] [lldb] Add a workaround for people that use *args instead of listing (PR #166883)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 7 11:10:50 PST 2025


================
@@ -188,8 +188,13 @@ class ScriptedPythonInterface : virtual public ScriptedInterface {
       // This addresses the cases where the embedded interpreter session
       // dictionary is passed to the extension initializer which is not used
       // most of the time.
+      // Note, though none of our API's suggest defining the interfaces with
+      // varargs, we have some extant clients that were doing that.  To keep
+      // from breaking them, we just say putting a varargs in these signatures
+      // turns off argument checking.
       size_t num_args = sizeof...(Args);
-      if (num_args != arg_info->max_positional_args) {
+      if (arg_info->max_positional_args != PythonCallable::ArgInfo::UNBOUNDED &&
----------------
JDevlieghere wrote:

If we wanted to discourage this pattern, we could emit a warning with `Debugger::ReportWarning`. It takes an optional `once_flag` that would allow us to limit this warning to once per ScriptedPythonInterface instance or even once per lldb instance if we made it static. 

https://github.com/llvm/llvm-project/pull/166883


More information about the lldb-commits mailing list