From 1982c73ebc6039bf3753e6df00ac471c7dc4d619 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 25 Feb 2019 14:45:56 +1030 Subject: [PATCH] pylightning: support functions with type annotations. I tried annotating the plugin-millisatoshis.py plugin, and it failed like so: plugin-millisatoshis.py Killing plugin: "getmanifest" result is not an object: {"jsonrpc": "2.0", "id": 1, "error": "Error while processing getmanifest: ValueError(\'Function has keyword-only parameters or annotations, use getfullargspec() API which can support them\',)"}' So, let's do that! Signed-off-by: Rusty Russell --- contrib/pylightning/lightning/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/pylightning/lightning/plugin.py b/contrib/pylightning/lightning/plugin.py index dabe4c933..49f9af667 100644 --- a/contrib/pylightning/lightning/plugin.py +++ b/contrib/pylightning/lightning/plugin.py @@ -451,7 +451,7 @@ class Plugin(object): # Handles out-of-order use of parameters like: # def hello_obfus(arg1, arg2, plugin, thing3, request=None, thing5='at', thing6=21) - argspec = inspect.getargspec(method.func) + argspec = inspect.getfullargspec(method.func) defaults = argspec.defaults num_defaults = len(defaults) if defaults else 0 start_kwargs_idx = len(argspec.args) - num_defaults