From 1f4e269d26b163ef99cb4d9881bcd3925f319f51 Mon Sep 17 00:00:00 2001 From: training Date: Mon, 15 Jan 2024 05:34:55 -0500 Subject: [PATCH] rpc: fix 0-ady functions raising an exception Closes #130 --- src/p4p/rpc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p4p/rpc.py b/src/p4p/rpc.py index fba0623b..3fd9b7df 100644 --- a/src/p4p/rpc.py +++ b/src/p4p/rpc.py @@ -264,7 +264,8 @@ def _wrapMethod(K, V): if S.varargs is not None or keywords is not None: raise TypeError("vararg not supported for proxy method %s" % K) - if len(S.args) != len(S.defaults): + num_args, num_defaults = (0 if v is None else len(v) for v in (S.args, S.defaults)) + if num_args != num_defaults: raise TypeError("proxy method %s must specify types for all arguments" % K) try: