New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDLE: Regressions - Two ColorDelegator instances loaded #57704
Comments
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. |
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): This patch (2008-02-16) modified parts of the last patch, as well adds "ResetColorizer" to the filename_change_hook. |
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. |
If you are saying that it is better to open a blank window than to not open a filled window, I agree. |
I will split the "good_load" flag bug into its own issue. While addressing a bug in bpo-5492, another doubled-up ColorDelegator problem appeared, tracing back to bpo-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. |
New changeset fef7f212fe76 by Roger Serwy in branch '3.3': New changeset 588fcf36c975 by Roger Serwy in branch 'default': |
I'm closing this issue as fixed. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: