do not mutate dict we are iterating over

Risky at best, and actually raises an error on modern Python versions.
This commit is contained in:
Dennis Brakhane 2016-03-29 19:41:24 +02:00
parent 516e88c8fc
commit ed9bed425f
1 changed files with 2 additions and 2 deletions

View File

@ -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.