Browse Source

do not mutate dict we are iterating over

Risky at best, and actually raises an error on modern Python versions.
Dennis Brakhane 9 years ago
parent
commit
ed9bed425f
1 changed files with 2 additions and 2 deletions
  1. 2 2
      direct/src/gui/DirectGuiBase.py

+ 2 - 2
direct/src/gui/DirectGuiBase.py

@@ -505,7 +505,7 @@ class DirectGuiBase(DirectObject.DirectObject):
             # with corresponding keys beginning with *component*.
             alias = alias + '_'
             aliasLen = len(alias)
-            for option in keywords:
+            for option in keywords.copy():
                 if len(option) > aliasLen and option[:aliasLen] == alias:
                     newkey = component + '_' + option[aliasLen:]
                     keywords[newkey] = keywords[option]
@@ -537,7 +537,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         # specific than the group arguments, above; we walk through
         # the list afterwards so they will override.
 
-        for option in keywords:
+        for option in keywords.copy():
             if len(option) > nameLen and option[:nameLen] == componentPrefix:
                 # The keyword argument refers to this component, so add
                 # this to the options to use when constructing the widget.