From 025fbbc9eac9e3fcd352a535f9d0631229aee410 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 8 Jan 2019 19:24:33 +0100 Subject: [PATCH] pylightning: Always assign the `init` method in plugin Also fixes a crash if the doc was empty. --- contrib/pylightning/lightning/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/pylightning/lightning/plugin.py b/contrib/pylightning/lightning/plugin.py index f4e2d05fb..4232eb2b0 100644 --- a/contrib/pylightning/lightning/plugin.py +++ b/contrib/pylightning/lightning/plugin.py @@ -269,7 +269,7 @@ class Plugin(object): # then unstash this and call it. if 'init' in self.methods: self.init = self.methods['init'] - self.methods['init'] = (self._init, MethodType.RPCMETHOD) + self.methods['init'] = (self._init, MethodType.RPCMETHOD) partial = "" for l in self.stdin: @@ -295,12 +295,12 @@ class Plugin(object): continue doc = inspect.getdoc(func) - doc = re.sub('\n+', ' ', doc) if not doc: self.log( 'RPC method \'{}\' does not have a docstring.'.format(name) ) doc = "Undocumented RPC method from a plugin." + doc = re.sub('\n+', ' ', doc) methods.append({ 'name': name,