From 02ef49949991a739662a663ebe64ef00215c4e4d Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Wed, 28 Jun 2023 22:28:17 +0300 Subject: [PATCH] dispatcher: determine function argument count via inspect --- src/mdis/dispatcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mdis/dispatcher.py b/src/mdis/dispatcher.py index 63b1ebb..8455039 100644 --- a/src/mdis/dispatcher.py +++ b/src/mdis/dispatcher.py @@ -34,9 +34,9 @@ class Hook(object): def __call__(self, call): class ConcreteHook(Hook): def __call__(self, dispatcher, node, *arguments): - try: + if (len(inspect.signature(call).parameters) > 2): return call(dispatcher, node, *arguments) - except TypeError: + else: return call(dispatcher, node) return ConcreteHook(*tuple(self)) -- 2.30.2