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

SourceForge.net noreply at sourceforge.net
Wed Jul 11 14:36:50 CEST 2007


Patches item #1724999, was opened at 2007-05-24 11:53
Message generated for change (Comment added) made by gvanrossum
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: Pending
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Ali Gholami Rudi (aligrudi)
>Assigned to: Guido van Rossum (gvanrossum)
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.

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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2007-07-11 08:36

Message:
Logged In: YES 
user_id=6380
Originator: NO

Committed revision 56263.


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1724999&group_id=5470


More information about the Patches mailing list