From 9e58b2c936d1a81df8eb961c95c47cfbfc38e49c Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 1 Nov 2019 22:21:51 +0100 Subject: [PATCH] Owner: Fix @upkeep reply on recent Pypy versions. Because their gc.collect() function returns None. --- plugins/Owner/plugin.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/Owner/plugin.py b/plugins/Owner/plugin.py index 622432c67..3cd05f658 100644 --- a/plugins/Owner/plugin.py +++ b/plugins/Owner/plugin.py @@ -411,8 +411,14 @@ class Owner(callbacks.Plugin): collected = world.upkeep() if gc.garbage: L.append('Garbage! %r.' % gc.garbage) - L.append(format('%n collected.', (collected, 'object'))) - irc.reply(' '.join(L)) + if collected is not None: + # Some time between 5.2 and 7.1, Pypy (3?) started returning None + # when gc.collect() is called. + L.append(format('%n collected.', (collected, 'object'))) + if L: + irc.reply(' '.join(L)) + else: + irc.replySuccess() upkeep = wrap(upkeep, [additional(('literal', ['high']))]) def load(self, irc, msg, args, optlist, name):