Skip to content
This repository has been archived by the owner on Sep 11, 2019. It is now read-only.

Commit

Permalink
Fix iteration over pubsub list
Browse files Browse the repository at this point in the history
The iteration deleted from the list as it iterated, causing an item to
be skipped over (and potentially other undefined behaviour).
  • Loading branch information
bmerry committed Jan 19, 2018
1 parent b09b021 commit 0263ea8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fakenewsredis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0263ea8

Please sign in to comment.