Owner: Fix @upkeep reply on recent Pypy versions.

Because their gc.collect() function returns None.
This commit is contained in:
Valentin Lorentz 2019-11-01 22:21:51 +01:00
parent 10ccfbbf3c
commit 9e58b2c936

View File

@ -411,8 +411,14 @@ class Owner(callbacks.Plugin):
collected = world.upkeep() collected = world.upkeep()
if gc.garbage: if gc.garbage:
L.append('Garbage! %r.' % gc.garbage) L.append('Garbage! %r.' % gc.garbage)
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'))) L.append(format('%n collected.', (collected, 'object')))
if L:
irc.reply(' '.join(L)) irc.reply(' '.join(L))
else:
irc.replySuccess()
upkeep = wrap(upkeep, [additional(('literal', ['high']))]) upkeep = wrap(upkeep, [additional(('literal', ['high']))])
def load(self, irc, msg, args, optlist, name): def load(self, irc, msg, args, optlist, name):