classification
Title: IDLE: Regressions - Two ColorDelegator instances loaded
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.4, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: roger.serwy Nosy List: asvetlov, christian.heimes, kbk, python-dev, roger.serwy, terry.reedy
Priority: normal Keywords: patch

Created on 2011-11-28 19:56 by roger.serwy, last changed 2013-05-06 03:16 by roger.serwy. This issue is now closed.

Files
File name Uploaded Description Edit
colorbug.patch roger.serwy, 2011-11-28 19:56
issue13495.patch roger.serwy, 2011-12-05 07:35 review
issue13495_rev2.patch roger.serwy, 2012-01-15 05:51 review
dual_delegators.patch roger.serwy, 2013-04-20 02:32 review
Messages (7)
msg148513 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-11-28 19:56
Two instances of ColorDelegator are in the percolator chain. This is a regression from 2.x.

The problem can be found in __init__ of EditorWindow in EditorWindow.py.

Calling "io.loadfile" eventually calls "filename_change_hook" (See IOBinding.py's "set_filename"). The "filename_change_hook" calls "ResetColorizer" which brings up an instance of ColorDelegator. Then, the self.color reference is overwritten by a new ColorDelegator instance and added to the percolator chain.

The attached patch fixes the problem.
msg148864 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-12-05 07:35
I attached a better patch that preserves the goals of the original code while not creating two color delegators.

I traced down when the regression occurred (2007-09-06):
(a4bd8a4805a8) 1. Fail gracefully if the file fails to decode when loaded.

This patch (2008-02-16) modified parts of the last patch, as well adds "ResetColorizer" to the filename_change_hook.
(7c4c46342137) Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,605
msg151278 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-01-15 05:51
There was another regression introduced by (a4bd8a4805a8). IDLE 3 no longer allows for editing of new files from the command line. 

For example:

   idle -e /tmp/newfile.py 

will momentarily flash an editor window before it is closed. This is due to "good_load" not being set. What's worse is that the IDLE process will continue running without having any visible windows open. 

The rev2 patch removes the "good_load" flag and fixes the ColorDelegator issue.

I understand the purpose of the original code is to avoid displaying a blank editor in case of a decode error. The rev2 patch reintroduces this behavior. In my opinion, that behavior is not a serious problem.
msg151280 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-01-15 06:52
If you are saying that it is better to open a blank window than to not open a filled window, I agree.
msg187397 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-04-20 02:32
I will split the "good_load" flag bug into its own issue.

While addressing a bug in #5492, another doubled-up ColorDelegator problem appeared, tracing back to #1586.

The dual_delagators patch removes the code which loads the extra color delegators as well as ensures that ResetColorizer loads a color delegator since ispythonsource() now always returns True in a PyShell instance.
msg188486 - (view) Author: Roundup Robot (python-dev) Date: 2013-05-06 03:15
New changeset fef7f212fe76 by Roger Serwy in branch '3.3':
#13495: Avoid loading the color delegator twice in IDLE.
http://hg.python.org/cpython/rev/fef7f212fe76

New changeset 588fcf36c975 by Roger Serwy in branch 'default':
#13495: merge with 3.3.
http://hg.python.org/cpython/rev/588fcf36c975
msg188487 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-05-06 03:16
I'm closing this issue as fixed.
History
Date User Action Args
2013-05-06 03:16:25roger.serwysetstatus: open -> closed
resolution: fixed
messages: + msg188487

stage: patch review -> resolved
2013-05-06 03:15:34python-devsetnosy: + python-dev
messages: + msg188486
2013-04-20 02:32:06roger.serwysetfiles: + dual_delegators.patch
title: IDLE: Regressions - Two ColorDelegator instances loaded and -e no longer edits new files. -> IDLE: Regressions - Two ColorDelegator instances loaded
versions: + Python 3.4, - Python 3.2
messages: + msg187397

assignee: roger.serwy
2013-04-20 02:10:49roger.serwylinkissue5492 dependencies
2012-03-20 21:36:16asvetlovsetnosy: + asvetlov
2012-01-15 06:52:22terry.reedysetmessages: + msg151280
stage: patch review
2012-01-15 05:51:12roger.serwysetfiles: + issue13495_rev2.patch
title: IDLE: Regression - Two ColorDelegator instances loaded -> IDLE: Regressions - Two ColorDelegator instances loaded and -e no longer edits new files.
nosy: + terry.reedy

messages: + msg151278
2011-12-05 07:35:39roger.serwysetfiles: + issue13495.patch
nosy: + kbk, christian.heimes, - ned.deily
messages: + msg148864

2011-12-02 22:26:00terry.reedysetversions: - Python 3.1
2011-11-28 19:56:57roger.serwycreate