This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author roger.serwy
Recipients Todd.Rovito, benjamin.peterson, georg.brandl, larry, ned.deily, rhettinger, roger.serwy, terry.reedy
Date 2013-04-02.03:31:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1364873504.18.0.892563201728.issue17613@psf.upfronthosting.co.za>
In-reply-to
Content
It's a "race condition" due to ColorDelegator calling .update() in its recolorize method. The call to .update() flushes pending events, including callbacks into Python code that can change out the ColorDelegator in the Percolator chain. 

Here's a way to trigger this bug reliably. First we need an unreasonably large file that will make the syntax highlighting routine take a while. This code will generate such a file:


fid = open('/tmp/bigfile.py', 'w')
L = '\n'.join(map(lambda x: "#%i\n'%i'\n" % (x,x), range(10000)))
fid.writelines(L)
fid.close()


These next two steps need to be performed quickly to trigger the "race condition."

$ python -m idlelib.idle -e /tmp/bigfile.py
As soon as it loads, press Ctrl+Shift+S to bring up the Save-As dialog. 

You can take your time now. Overwrite the file. This triggers the filename_change_hook to call ResetColorizer, which removes the current ColorDelegator from the Percolator chain and inserts a new one. Wait a moment for the traceback to arrive.

The attached patch fixes the issue. When the ColorDelegator is removed by Percolator's removefilter, the delegate is set to None. The patch detects that condition and then sets flags to stop the colorizer from continuing.


In testing for this bug, I encountered another one. Pressing Alt-F4 quickly after the window loading bigfile appears triggers another traceback. I'll open a separate issue for that.
History
Date User Action Args
2013-04-02 03:31:44roger.serwysetrecipients: + roger.serwy, georg.brandl, rhettinger, terry.reedy, larry, benjamin.peterson, ned.deily, Todd.Rovito
2013-04-02 03:31:44roger.serwysetmessageid: <1364873504.18.0.892563201728.issue17613@psf.upfronthosting.co.za>
2013-04-02 03:31:44roger.serwylinkissue17613 messages
2013-04-02 03:31:43roger.serwycreate