mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
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 <rusty@rustcorp.com.au>
This commit is contained in:
parent
e3bdc32ee8
commit
1982c73ebc
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user