New submission from Quentin Gallet-Gilles:
While investigating for the stdlib reorg of Tkinter, I came across the
following error:
~/dev/py3k$ ./python Lib/lib-tk/Dialog.py
Traceback (most recent call last):
File "Lib/lib-tk/Dialog.py", line 45, in <module>
Pack: {}})
File "/home/quentin/dev/py3k/Lib/lib-tk/Tkinter.py", line 1996, in
__init__
Widget.__init__(self, master, 'button', cnf, kw)
File "/home/quentin/dev/py3k/Lib/lib-tk/Tkinter.py", line 1921, in
__init__
for k in cnf.keys():
RuntimeError: dictionary changed size during iteration
The attached patch adds list() around the dict.keys() call.
On a related note, this doesn't appear to be an isolated error, since a
similar issue (#1649) was recently fixed in r59554. Would it be a good
idea to look for other identical cases ?
----------
components: Tkinter
files: tkinter_dictkeys.patch
messages: 58805
nosy: quentin.gallet-gilles
severity: normal
status: open
title: "RuntimeError: dictionary changed size during iteration" in Tkinter
type: crash
versions: Python 3.0
Added file: http://bugs.python.org/file8995/tkinter_dictkeys.patch
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1658>
__________________________________
Index: Lib/lib-tk/Tkinter.py
===================================================================
--- Lib/lib-tk/Tkinter.py (revision 59567)
+++ Lib/lib-tk/Tkinter.py (working copy)
@@ -1918,7 +1918,7 @@
self.widgetName = widgetName
BaseWidget._setup(self, master, cnf)
classes = []
- for k in cnf.keys():
+ for k in list(cnf.keys()):
if isinstance(k, type):
classes.append((k, cnf[k]))
del cnf[k]
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com