subtract 1 arg if the method is a bound method

This commit is contained in:
Benedikt Bartscher 2024-11-10 23:20:04 +01:00
parent e0d1a58496
commit 8f578d9e60
No known key found for this signature in database

View File

@ -1353,6 +1353,10 @@ def check_fn_match_arg_spec(
number_of_event_args = len(parsed_event_args) number_of_event_args = len(parsed_event_args)
# Subtract 1 if the method is a bound method
if inspect.ismethod(user_func):
number_of_user_args -= 1
if number_of_user_args - number_of_user_default_args > number_of_event_args: if number_of_user_args - number_of_user_default_args > number_of_event_args:
raise EventFnArgMismatch( raise EventFnArgMismatch(
f"Event {key} only provides {number_of_event_args} arguments, but " f"Event {key} only provides {number_of_event_args} arguments, but "