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: ValueError; Completions not working right on macOS #86025

Closed
rhettinger opened this issue Sep 25, 2020 · 7 comments
Closed

IDLE: ValueError; Completions not working right on macOS #86025

rhettinger opened this issue Sep 25, 2020 · 7 comments
Assignees
Labels
3.9 only security fixes OS-mac topic-IDLE

Comments

@rhettinger
Copy link
Contributor

BPO 41859
Nosy @rhettinger, @terryjreedy, @ronaldoussoren, @ned-deily
Superseder
  • bpo-41611: IDLE: problems with completions on Mac
  • 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 2021-02-20.06:36:16.255>
    created_at = <Date 2020-09-25.04:12:05.372>
    labels = ['OS-mac', 'expert-IDLE', '3.9']
    title = 'IDLE: ValueError; Completions not working right on macOS'
    updated_at = <Date 2021-02-20.06:36:16.242>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2021-02-20.06:36:16.242>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2021-02-20.06:36:16.255>
    closer = 'terry.reedy'
    components = ['IDLE', 'macOS']
    creation = <Date 2020-09-25.04:12:05.372>
    creator = 'rhettinger'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41859
    keywords = []
    message_count = 7.0
    messages = ['377479', '377481', '377494', '377519', '377601', '377733', '387394']
    nosy_count = 4.0
    nosy_names = ['rhettinger', 'terry.reedy', 'ronaldoussoren', 'ned.deily']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '41611'
    type = None
    url = 'https://bugs.python.org/issue41859'
    versions = ['Python 3.9']

    @rhettinger
    Copy link
    Contributor Author

    I found this in today's long running shell session. The trigger event isn't known.

    Exception in Tkinter callback
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py", line 1885, in __call__
        return self.func(*args)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/multicall.py", line 176, in handler
        r = l[i](event)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/autocomplete_w.py", line 430, in keyrelease_event
        self.hide_window()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/autocomplete_w.py", line 447, in hide_window
        self.widget.event_delete(HIDE_VIRTUAL_EVENT_NAME, seq)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/multicall.py", line 392, in event_delete
        triplets.remove(triplet)
    ValueError: list.remove(x): x not in list

    @rhettinger rhettinger added the 3.9 only security fixes label Sep 25, 2020
    @terryjreedy
    Copy link
    Member

    I presume that at some point you got a completion box.  It disappeared with this traceback and when >>> appeared, you continued.  What python binary? 3.8.5?  3.8.6? My diagnosis so far.

    __call__ is a method in CallWrapper. The wrapped func is multicall.handler. The exception was caught in the
    except: self.widget._report_exception()
    clause of __call__, but it should never have been raised.

    keyrelease_event catches internal errors. If the insert cursor is not where IDLE expects, because "# we didn't catch an event which moved the insert", IDLE just closes box rather than trying to recover. I presume that this should never happen. But when it did, a ValueError was raised for the reason given. In this error state, multicall.event_delete makes an invalid assumption.

    The simple and immediate fix would be to catch the very rare delete failure. A better and harder fix would be to catch the uncaught insert-moving event. For this, it would have been nice if keyrelease displayed a message identifying the released key with an email request. I should try to reproduce the failure (including on Mac) by trying every key (or type of key) that might possibly move the cursor.

    @rhettinger
    Copy link
    Contributor Author

    What python binary?

    This is from the 64-bit macOS build on python.org:

        $ python3.9
        Python 3.9.0rc2 (v3.9.0rc2:2bd31b5fde, Sep 16 2020, 20:19:18)
        [Clang 6.0 (clang-600.0.57)] on darwin

    Thanks for looking into this :-)

    Let me know if filing these issues is helpful to you. I log a couple thousand hours of heavy IDLE usage each year and my students really put the tool through its paces. We tend to uncover buglets that wouldn't surface in light testing. At the end of the day, if there are tracebacks I haven't seen before, I'm posting them here. Hopefully, they are useful.

    @terryjreedy
    Copy link
    Member

    On Windows, the only key I found that closed the completion box via keyrelease_event is Left Arrow. If I explicitly caught that, the method might not be needed on Windows. Next I will look at the triplets list and how something might be missing or deleted twice.

    On my Mac Airbook with current 3.8.6 and 3.9.0rc2, I cannot get a completion box, even with the menu. Do you have the same issue?

    Reports with a traceback, like this one, are helpful and welcome. If possible, include and information about either the code or action that triggered the exception.

    @terryjreedy
    Copy link
    Member

    Reports with a reproducer are also helpful.

    Again, can you get a completion box at all?

    @rhettinger
    Copy link
    Contributor Author

    I don't have a reproducer. The event occurred one in a full-day session.

    I don't get a completion box.

    @terryjreedy
    Copy link
    Member

    This seemingly random error involved completions and there is already an issue about them not working right on macOS. It was also opened by Raymond as a result of another 'random' error in an all day session.

    @terryjreedy terryjreedy changed the title Uncaught ValueError IDLE: ValueError; Completions not working right on macOS Feb 20, 2021
    @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.9 only security fixes OS-mac topic-IDLE
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants