matplotlib/matplotlib — pull request #588 by takluyver (2011-11-15 00:13:30+00:00)
Title: Do not modify dict while iterating over it

Modifying a dictionary while iterating over it is forbidden since at least Python 2.7, and (from a quick search) probably earlier. This simply builds a list of keys to remove, then iterates over that list to remove them.