From 0263ea8324f4b8888c6964694e2e7ad5117dd8ca Mon Sep 17 00:00:00 2001 From: Bruce Merry Date: Fri, 19 Jan 2018 17:05:59 +0200 Subject: [PATCH] Fix iteration over pubsub list The iteration deleted from the list as it iterated, causing an item to be skipped over (and potentially other undefined behaviour). --- fakenewsredis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fakenewsredis.py b/fakenewsredis.py index 79930f1..f41b3f6 100644 --- a/fakenewsredis.py +++ b/fakenewsredis.py @@ -1675,7 +1675,7 @@ def publish(self, channel, message): ``message`` to them for the given ``channel``. """ count = 0 - for i, ps in enumerate(self._pubsubs): + for i, ps in list(enumerate(self._pubsubs)): if not ps.subscribed: del self._pubsubs[i] continue