[ python-Patches-1724999 ] dict size changes during iter

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.python.patches
Message-ID <[email protected]>
Patches item #1724999, was opened at 2007-05-24 19:23
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1724999&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tkinter
Group: Python 3000
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ali Gholami Rudi (aligrudi)
Assigned to: Martin v. Löwis (loewis)
Summary: dict size changes during iter

Initial Comment:
In p3yk branch and Ubuntu 2.6.20-15

In::

  from Tkinter import *


  root = Tk()
  toplevel = Toplevel()
  def destroy():
      toplevel.destroy()
  button = Button(toplevel, text='Press Me',
                  command=destroy)
  button.pack()
  toplevel.focus_set()

  root.mainloop()

When the button is pressed I get::

  Exception in Tkinter callback
  Traceback (most recent call last):
    File "/usr/local/lib/python3.0/lib-tk/Tkinter.py", line 1403, in __call__
      return self.func(*args)
    File "mod.py", line 7, in destroy
      toplevel.destroy()
    File "/usr/local/lib/python3.0/lib-tk/Tkinter.py", line 1935, in destroy
      for c in self.children.values(): c.destroy()
  RuntimeError: dictionary changed size during iteration

The attached patch solves this.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1724999&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.