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 cond context: fix code update and font update timers #75674

Closed
terryjreedy opened this issue Sep 16, 2017 · 6 comments
Closed

IDLE cond context: fix code update and font update timers #75674

terryjreedy opened this issue Sep 16, 2017 · 6 comments
Assignees
Labels
3.7 (EOL) end of life topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 31493
Nosy @terryjreedy, @csabella
PRs
  • bpo-31493: Fix code context update and font update timers. #3622
  • [3.6] bpo-31493: Fix code context update and font update timers. (GH-3622) #3623
  • 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/terryjreedy'
    closed_at = <Date 2018-05-23.05:25:54.854>
    created_at = <Date 2017-09-16.20:47:15.593>
    labels = ['expert-IDLE', 'type-bug', '3.7']
    title = 'IDLE cond context: fix code update and font update timers'
    updated_at = <Date 2018-05-23.05:25:54.853>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2018-05-23.05:25:54.853>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2018-05-23.05:25:54.854>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2017-09-16.20:47:15.593>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31493
    keywords = ['patch']
    message_count = 6.0
    messages = ['302352', '302359', '302360', '302628', '302706', '317360']
    nosy_count = 2.0
    nosy_names = ['terry.reedy', 'cheryl.sabella']
    pr_nums = ['3622', '3623']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31493'
    versions = ['Python 3.6', 'Python 3.7']

    @terryjreedy
    Copy link
    Member Author

    1. Currently, each instance of codecontext.CodeContext creates 2 root.after loops. There should be at most two loops for the class, and preferably fewer by using the new reload().

    2. The loops are never explicitly shut down. Since conversion to a feature, the following appears after running test_idle.

    .invalid command name "109891384timer_event"
    while executing
    "109891384timer_event"
    ("after" script)
    invalid command name "109891512font_timer_event"
    while executing
    "109891512font_timer_event"
    ("after" script)

    This is because of
    File "F:\dev\3x\lib\idlelib\idle_test\test_outwin.py", line 20, in setUpClass
    w = cls.window = outwin.OutputWindow(None, None, None, root)
    File "F:\dev\3x\lib\idlelib\outwin.py", line 78, in __init__
    EditorWindow.__init__(self, *args)
    File "F:\dev\3x\lib\idlelib\editor.py", line 319, in __init__
    text.bind("<<toggle-code-context>>", # added to traceback
    self.CodeContext(self).toggle_code_context_event)

    The statement, which creates an instance, was added as part of the conversion. However, the outwin tests were merged a week before the conversion, so this message might have started the. In any case, editor.EditorWindow.load_extension does the same thing in doing the binding. It is not clear why there is no message from other editor-creating tests.

    I want to fix at least this before next Monday's cutoff for new releases. I will first try is after_cancel in a __del__ method.

    @terryjreedy terryjreedy added the 3.7 (EOL) end of life label Sep 16, 2017
    @terryjreedy terryjreedy self-assigned this Sep 16, 2017
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error labels Sep 16, 2017
    @terryjreedy
    Copy link
    Member Author

    New changeset a6bb313 by Terry Jan Reedy in branch 'master':
    bpo-31493: Fix code context update and font update timers. (bpo-3622)
    a6bb313

    @terryjreedy
    Copy link
    Member Author

    New changeset b417332 by Terry Jan Reedy (Miss Islington (bot)) in branch '3.6':
    [3.6] bpo-31493: Fix code context update and font update timers. (GH-3622) (bpo-3623)
    b417332

    @csabella
    Copy link
    Contributor

    Sorry, I didn't see this until now.

    I added a line to editor.py in bpo-31529 for this error message. In _close() in editor.py, self.text was being set to None which wasn't calling the del function of multicall. I added a line to unbind "<>", which made the error go away. I don't know if that's the proper fix or not, but it seemed the error was occurring because the after wasn't being removed at the right time.

    @terryjreedy
    Copy link
    Member Author

    The underlying issue is trying to coordinate two somewhat independent object systems (Python and Tcl). I don't know why the after loops were (apparently) stopped before bpo-27099 and not after. The only difference I know of is the dropping of the reference to CodeContext instances in .unload_extensions, called from ._close. CodeContext did not have a .close method.

    I tried the first thing I thought might work and it did, so I stopped. I don't know why unbinding the toggle function was enough. I expect that we will eventually review ._close. It should help when the menu and editor are separated a bit.

    @terryjreedy
    Copy link
    Member Author

    The patch fixed immediate problem #2 above. #1 is a separate enhancement and I listed it as #4 on the new master issue bpo-33610.

    @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
    3.7 (EOL) end of life topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants