diff options
author | Guilherme Polo <ggpolo@gmail.com> | 2008-09-04 11:21:31 (GMT) |
---|---|---|
committer | Guilherme Polo <ggpolo@gmail.com> | 2008-09-04 11:21:31 (GMT) |
commit | b212b75c226482ea119140d908e808fd9e75c46c (patch) | |
tree | d61f28ef09dac30d968abbb4b6199e8aa49bda55 | |
parent | c96cba047ba8a2652b50dfb932ccda4597a68876 (diff) | |
download | cpython-b212b75c226482ea119140d908e808fd9e75c46c.zip cpython-b212b75c226482ea119140d908e808fd9e75c46c.tar.gz cpython-b212b75c226482ea119140d908e808fd9e75c46c.tar.bz2 |
Issue #1658: dict size is changing during iteration in tkinter.BaseWidget and
tkinter.scrolledtext.ScrolledText.
Reviewed by Amaury Forgeot d'Arc
-rw-r--r-- | Lib/tkinter/__init__.py | 8 | ||||
-rw-r--r-- | Lib/tkinter/scrolledtext.py | 9 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
3 files changed, 10 insertions, 10 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index faca78f..bb014b3 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -1913,11 +1913,9 @@ class BaseWidget(Misc): cnf = _cnfmerge((cnf, kw)) self.widgetName = widgetName BaseWidget._setup(self, master, cnf) - classes = [] - for k in cnf.keys(): - if isinstance(k, type): - classes.append((k, cnf[k])) - del cnf[k] + classes = [(k, v) for k, v in cnf.items() if isinstance(k, type)] + for k, v in classes: + del cnf[k] self.tk.call( (widgetName, self._w) + extra + self._options(cnf)) for k, v in classes: diff --git a/Lib/tkinter/scrolledtext.py b/Lib/tkinter/scrolledtext.py index 084c3bf..35767e6 100644 --- a/Lib/tkinter/scrolledtext.py +++ b/Lib/tkinter/scrolledtext.py @@ -19,11 +19,10 @@ class ScrolledText(Text): cnf = {} if kw: cnf = _cnfmerge((cnf, kw)) - fcnf = {} - for k in cnf.keys(): - if isinstance(k, type) or k == 'name': - fcnf[k] = cnf[k] - del cnf[k] + fcnf = {k:v for k,v in cnf.items() if isinstance(k,type) or k=='name'} + for k in fcnf.keys(): + del cnf[k] + self.frame = Frame(master, **fcnf) self.vbar = Scrollbar(self.frame, name='vbar') self.vbar.pack(side=RIGHT, fill=Y) @@ -77,6 +77,9 @@ C API Library ------- +- Issue #1658: tkinter changes dict size during iteration in both + tkinter.BaseWidget and tkinter.scrolledtext.ScrolledText. + - The bsddb module (and therefore the dbm.bsd module) has been removed. It is now maintained outside of the standard library at http://www.jcea.es/programacion/pybsddb.htm. |