Skip to content

Commit

Permalink
rpc: fix 0-ady functions raising an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Synthetica9 committed Jan 15, 2024
1 parent f5c96ba commit d57f61a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/p4p/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,14 @@ 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):
args, defaults = ([] if v is None else v for v in (S.args, S.defaults))
if len(args) != len(defaults):
raise TypeError("proxy method %s must specify types for all arguments" % K)

try:
NT = NTURI(zip(S.args, S.defaults))
NT = NTURI(zip(args, defaults))
except Exception as e:
raise TypeError("%s : failed to build method from %s, %s" % (e, S.args, S.defaults))
raise TypeError("%s : failed to build method from %s, %s" % (e, args, defaults))

@wraps(V)
def mcall(self, *args, **kws):
Expand Down

0 comments on commit d57f61a

Please sign in to comment.