Skip to content

Commit 690064f

Browse files
committed
pylightning: don't compare v with inspect._empty.
I originally converted input JSON naively into Millisatoshi, and the result was a strange failure in Millisatoshi.__eq__. It seems this is because inspect._empty.__eq__(Millisatoshi) raises NotImplemented, and so it tries Millisatoshi.__eq__(inspect._empty) which doesn't like it. 'is' is the correct test here, AFAICT, and doesn't suffer from these problems. Signed-off-by: Rusty Russell <[email protected]>
1 parent 6ace13b commit 690064f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/pylightning/lightning/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def _exec_func(self, func, request):
300300
pos = 0
301301
for k, v in arguments.items():
302302
# Skip already assigned args and special catch-all args
303-
if v != inspect._empty or k in ['args', 'kwargs']:
303+
if v is not inspect._empty or k in ['args', 'kwargs']:
304304
continue
305305

306306
if pos < len(params):
@@ -326,7 +326,7 @@ def _exec_func(self, func, request):
326326
elif len(args) > 0:
327327
raise TypeError("Extra arguments given: {args}".format(args=args))
328328

329-
missing = [k for k, v in arguments.items() if v == inspect._empty]
329+
missing = [k for k, v in arguments.items() if v is inspect._empty]
330330
if missing:
331331
raise TypeError("Missing positional arguments ({given} given, "
332332
"expected {expected}): {missing}".format(

0 commit comments

Comments
 (0)