Skip to content

Commit

Permalink
Fix size changed during iteration. (#7956)
Browse files Browse the repository at this point in the history
`dict.values()` is a generator. So it can cause errors when the dict is changed during iteration.

Prevent this by casting to an array, before iterating. Most py2 backwards compatible solution.
  • Loading branch information
p0psicles authored Apr 12, 2020
1 parent b51dd2d commit 73d2834
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions medusa/scene_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ def get_scene_exceptions_by_name(show_name):
"""Get the series_id, season and indexer of the scene exception."""
# Flatten the exceptions_cache.
scene_exceptions = set()
for exception_set in exceptions_cache.values():
for title_exception in exception_set.values():
for exception_set in list(exceptions_cache.values()):
for title_exception in list(exception_set.values()):
scene_exceptions.update(title_exception)

matches = set()
Expand Down

0 comments on commit 73d2834

Please sign in to comment.