Skip to content
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

Closed
serwy mannequin opened this issue Nov 28, 2011 · 7 comments
Closed

IDLE: Regressions - Two ColorDelegator instances loaded #57704

serwy mannequin opened this issue Nov 28, 2011 · 7 comments
Assignees
Labels
topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@serwy
Copy link
Mannequin

serwy mannequin commented Nov 28, 2011

BPO 13495
Nosy @terryjreedy, @kbkaiser, @tiran, @serwy, @asvetlov
Files
  • colorbug.patch
  • issue13495.patch
  • issue13495_rev2.patch
  • dual_delegators.patch
  • 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:

    assignee = 'https://github.com/serwy'
    closed_at = <Date 2013-05-06.03:16:25.306>
    created_at = <Date 2011-11-28.19:56:57.211>
    labels = ['expert-IDLE', 'type-bug']
    title = 'IDLE: Regressions - Two ColorDelegator instances loaded'
    updated_at = <Date 2013-05-06.03:16:25.305>
    user = 'https://github.com/serwy'

    bugs.python.org fields:

    activity = <Date 2013-05-06.03:16:25.305>
    actor = 'roger.serwy'
    assignee = 'roger.serwy'
    closed = True
    closed_date = <Date 2013-05-06.03:16:25.306>
    closer = 'roger.serwy'
    components = ['IDLE']
    creation = <Date 2011-11-28.19:56:57.211>
    creator = 'roger.serwy'
    dependencies = []
    files = ['23798', '23854', '24243', '29946']
    hgrepos = []
    issue_num = 13495
    keywords = ['patch']
    message_count = 7.0
    messages = ['148513', '148864', '151278', '151280', '187397', '188486', '188487']
    nosy_count = 6.0
    nosy_names = ['terry.reedy', 'kbk', 'christian.heimes', 'roger.serwy', 'asvetlov', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue13495'
    versions = ['Python 3.3', 'Python 3.4']

    @serwy
    Copy link
    Mannequin Author

    serwy mannequin commented Nov 28, 2011

    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.

    @serwy serwy mannequin added topic-IDLE type-bug An unexpected behavior, bug, or error labels Nov 28, 2011
    @serwy
    Copy link
    Mannequin Author

    serwy mannequin commented Dec 5, 2011

    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

    @serwy
    Copy link
    Mannequin Author

    serwy mannequin commented Jan 15, 2012

    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.

    @serwy serwy mannequin changed the title IDLE: Regression - Two ColorDelegator instances loaded IDLE: Regressions - Two ColorDelegator instances loaded and -e no longer edits new files. Jan 15, 2012
    @terryjreedy
    Copy link
    Member

    If you are saying that it is better to open a blank window than to not open a filled window, I agree.

    @serwy
    Copy link
    Mannequin Author

    serwy mannequin commented Apr 20, 2013

    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.

    @serwy serwy mannequin changed the title IDLE: Regressions - Two ColorDelegator instances loaded and -e no longer edits new files. IDLE: Regressions - Two ColorDelegator instances loaded Apr 20, 2013
    @serwy serwy mannequin self-assigned this Apr 20, 2013
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 6, 2013

    New changeset fef7f212fe76 by Roger Serwy in branch '3.3':
    bpo-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':
    bpo-13495: merge with 3.3.
    http://hg.python.org/cpython/rev/588fcf36c975

    @serwy
    Copy link
    Mannequin Author

    serwy mannequin commented May 6, 2013

    I'm closing this issue as fixed.

    @serwy serwy mannequin closed this as completed May 6, 2013
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant