guilherme.polo
2008-09-04 11:21:31 UTC
Author: guilherme.polo
Date: Thu Sep 4 13:21:31 2008
New Revision: 66215
Log:
Issue #1658: dict size is changing during iteration in tkinter.BaseWidget and
tkinter.scrolledtext.ScrolledText.
Reviewed by Amaury Forgeot d'Arc
Modified:
python/branches/py3k/Lib/tkinter/__init__.py
python/branches/py3k/Lib/tkinter/scrolledtext.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/tkinter/__init__.py
==============================================================================
--- python/branches/py3k/Lib/tkinter/__init__.py (original)
+++ python/branches/py3k/Lib/tkinter/__init__.py Thu Sep 4 13:21:31 2008
@@ -1913,11 +1913,9 @@
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:
Modified: python/branches/py3k/Lib/tkinter/scrolledtext.py
==============================================================================
--- python/branches/py3k/Lib/tkinter/scrolledtext.py (original)
+++ python/branches/py3k/Lib/tkinter/scrolledtext.py Thu Sep 4 13:21:31 2008
@@ -19,11 +19,10 @@
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)
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Thu Sep 4 13:21:31 2008
@@ -77,6 +77,9 @@
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.
Date: Thu Sep 4 13:21:31 2008
New Revision: 66215
Log:
Issue #1658: dict size is changing during iteration in tkinter.BaseWidget and
tkinter.scrolledtext.ScrolledText.
Reviewed by Amaury Forgeot d'Arc
Modified:
python/branches/py3k/Lib/tkinter/__init__.py
python/branches/py3k/Lib/tkinter/scrolledtext.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/tkinter/__init__.py
==============================================================================
--- python/branches/py3k/Lib/tkinter/__init__.py (original)
+++ python/branches/py3k/Lib/tkinter/__init__.py Thu Sep 4 13:21:31 2008
@@ -1913,11 +1913,9 @@
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:
Modified: python/branches/py3k/Lib/tkinter/scrolledtext.py
==============================================================================
--- python/branches/py3k/Lib/tkinter/scrolledtext.py (original)
+++ python/branches/py3k/Lib/tkinter/scrolledtext.py Thu Sep 4 13:21:31 2008
@@ -19,11 +19,10 @@
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)
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Thu Sep 4 13:21:31 2008
@@ -77,6 +77,9 @@
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.