Skip to content

Commit 18ec347

Browse files
committed
Add a workaround for people that use *args instead of listing
parameters when defining the scripting interfaces. We try to count the parameters to make sure the user has defined them correctly, but this throws the counting off. I'm not adding a test for this because then it would seem like we thought this was a good idea. I'd actually rather not support it altogether, but we added the parameter checking pretty recently so there are extant implementations that we broke. I only want to support them, not suggest anyone else do this going forward.
1 parent 71550ff commit 18ec347

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,13 @@ class ScriptedPythonInterface : virtual public ScriptedInterface {
188188
// This addresses the cases where the embedded interpreter session
189189
// dictionary is passed to the extension initializer which is not used
190190
// most of the time.
191+
// Note, though none of our API's suggest defining the interfaces with
192+
// varargs, we have some extant clients that were doing that. To keep
193+
// from breaking them, we just say putting a varargs in these signatures
194+
// turns off argument checking.
191195
size_t num_args = sizeof...(Args);
192-
if (num_args != arg_info->max_positional_args) {
196+
if (arg_info->max_positional_args != PythonCallable::ArgInfo::UNBOUNDED
197+
&& num_args != arg_info->max_positional_args) {
193198
if (num_args != arg_info->max_positional_args - 1)
194199
return create_error("Passed arguments ({0}) doesn't match the number "
195200
"of expected arguments ({1}).",

0 commit comments

Comments
 (0)