classification
Title: IDLE crashes if Preference set to At Startup -> Open Edit Window
Type: crash Stage:
Components: IDLE Versions: Python 3.3, Python 3.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Bruce.Sherwood, mhuster, serwy, taleinat
Priority: normal Keywords: patch

Created on 2010-06-04 23:58 by mhuster, last changed 2011-12-11 16:32 by serwy.

Files
File name Uploaded Description Edit
issue8900.patch serwy, 2011-12-11 16:32 review
Messages (4)
msg107113 - (view) Author: Michael Huster (mhuster) Date: 2010-06-04 23:58
This only seems to be a problem under Windows.
From a Portable Python discussion:
I am using Portable Python 1.1, python 3.0.1.
I am trying to set up a .bat file file to easily start IDLE. But IDLE
is throwing an error and failing some of the time.
It only happens if IDLE is set up to start in the edit mode. (Which I
prefer.) And then it only throws the error the first time a file is
opened. It doesn't seem to matter what kind of file is opened. The
other symptom is that a new line is inserted at the top of the file
that is opened.

The error is (I'm typing it by hand):
Exception in Tkinter callback
Traceback (most recent call last):
 File "E:\py30\App\lib\tkinter\__init__.py", line 1399, in __call__
   return self.func(*args)
 File "E:\py30\App\lib\idlelib\MultiCall.py", line 174, in handler
doafterhandler.pop()()
 File "E:\py30\App\lib\idlelib\MultiCall.py", line 221, in <lambda>
doit = lambda: self.bindedfuncs[triplet[2]][triplet[0]].remove(func)
ValueError: list.remove(x): x not in list

I can work around this with a batch file that uses python.exe, not
pythonw.exe, but it leaves an annoying command shell window open.

I also tested IDLE under a normal python installation and the same thing happens, so, sorry, it is not a PP thing. There must be a bug in IDLE under py 3.0. I'll file this with python.org.
msg107128 - (view) Author: Tal Einat (taleinat) (Python committer) Date: 2010-06-05 10:36
I can consistently reproduce this with Python 3.0.1 by setting IDLE to start in editing mode and using Ctrl+o to open the Open dialog. Doesn't happen when using the menu item in the File menu.

This leads me to believe it has something to do with keypress event processing. Also, the event for which the unbind call is failing is <Control-KeyPress-slash>.

Continuing to investigate.
msg118698 - (view) Author: Bruce Sherwood (Bruce.Sherwood) Date: 2010-10-14 17:32
Putting print statements in that part of the world shows that the reason why the list.remove fails is that while a ColorDelegator.toggle_colorize_event object is in the list, it has a different memory address than the ColorDelegator.toggle_colorize_event object to be removed. I've seen this NOT fail occasionally (the memory addresses were the same, so the list.remove succeeded), all of which would seem to imply that something has moved in memory.

I'll mention that when the failure occurs, the list always has just one object, a ColorDelegator.toggle_colorize_event object.
msg149228 - (view) Author: Roger Serwy (serwy) * Date: 2011-12-11 16:32
Attached is a patch to fix the bug.

When selecting "Open" from the File Menu, "ishanderrunning" is empty. Unbind/Bind requests are handled synchronously.

When pressing "Ctrl+O", "ishandlerrunning" is no longer empty, and the actual bind/unbind events get appended to "doafterhandle". 

The original code was running these bind/unbind events in REVERSE order by using "pop", so unbind requests were being made (and causing the error) before the proper bind request.
History
Date User Action Args
2011-12-11 16:32:33serwysetfiles: + issue8900.patch
versions: + Python 3.2, Python 3.3, - Python 3.1
nosy: + serwy

messages: + msg149228

keywords: + patch
2010-10-14 17:32:21Bruce.Sherwoodsetnosy: + Bruce.Sherwood
messages: + msg118698
2010-06-05 10:36:43taleinatsetnosy: + taleinat
messages: + msg107128
2010-06-04 23:58:16mhustercreate