From ed9bed425fab1de413deaa2f07fc5d22b6eba0cf Mon Sep 17 00:00:00 2001 From: Dennis Brakhane Date: Tue, 29 Mar 2016 19:41:24 +0200 Subject: [PATCH] do not mutate dict we are iterating over Risky at best, and actually raises an error on modern Python versions. --- direct/src/gui/DirectGuiBase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/direct/src/gui/DirectGuiBase.py b/direct/src/gui/DirectGuiBase.py index 633b9615c0..95ad70158a 100644 --- a/direct/src/gui/DirectGuiBase.py +++ b/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.