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: Disable F5, etc, in Shell and Output windows. #82779

Closed
terryjreedy opened this issue Oct 26, 2019 · 6 comments
Closed

IDLE: Disable F5, etc, in Shell and Output windows. #82779

terryjreedy opened this issue Oct 26, 2019 · 6 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 38598
Nosy @terryjreedy, @taleinat, @miss-islington
PRs
  • bpo-38598: Do not try to compile IDLE shell or output windows #16939
  • [3.7] bpo-38598: Do not try to compile IDLE shell or output windows (GH-16939) #16941
  • [3.8] bpo-38598: Do not try to compile IDLE shell or output windows (GH-16939) #16942
  • 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 2019-10-27.01:42:09.162>
    created_at = <Date 2019-10-26.21:03:56.483>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7', '3.9']
    title = 'IDLE: Disable F5, etc, in Shell and Output windows.'
    updated_at = <Date 2019-10-29.18:59:18.434>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2019-10-29.18:59:18.434>
    actor = 'taleinat'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2019-10-27.01:42:09.162>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2019-10-26.21:03:56.483>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38598
    keywords = ['patch']
    message_count = 6.0
    messages = ['355432', '355434', '355437', '355438', '355439', '355669']
    nosy_count = 3.0
    nosy_names = ['terry.reedy', 'taleinat', 'miss-islington']
    pr_nums = ['16939', '16941', '16942']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue38598'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @terryjreedy
    Copy link
    Member Author

    When the Shell is active, the Run menu is disabled, but its shortcuts are not. These are F5 Run Module, Shift-F5 Run ... Custom, and Alt-X Check Module. If Shell has not been saved, the shortcuts do nothing, but once Shell has been saved, they try to compile the entire shell session.

    The result is that the '3' in 'Python 3.8 ...' on the first line is highlighted as an error and the SyntaxError box pops up. When the box is dismissed, the cursor is placed after the '3'.

    Instead of calling compile, IDLE should beep and continue.

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes labels Oct 26, 2019
    @terryjreedy terryjreedy self-assigned this Oct 26, 2019
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error labels Oct 26, 2019
    @terryjreedy
    Copy link
    Member Author

    Trying to compile grep output is also bad. The ultimate fix is to subclass the specialized code editor from the general text editor, instead of vice versa as at present, but I leave that for later, and will simply check if the window about to be compiled is an instance of OutputWindow (which is also the PyShell superclass).

    @terryjreedy terryjreedy changed the title IDLE: Disable F5, etc, in Shell, even after saving IDLE: Disable F5, etc, in Shell and Output windows. Oct 26, 2019
    @terryjreedy
    Copy link
    Member Author

    New changeset e3f90b2 by Terry Jan Reedy in branch 'master':
    bpo-38598: Do not try to compile IDLE shell or output windows (GH-16939)
    e3f90b2

    @miss-islington
    Copy link
    Contributor

    New changeset 849b1b9 by Miss Skeleton (bot) in branch '3.7':
    bpo-38598: Do not try to compile IDLE shell or output windows (GH-16939)
    849b1b9

    @miss-islington
    Copy link
    Contributor

    New changeset e3a477a by Miss Skeleton (bot) in branch '3.8':
    bpo-38598: Do not try to compile IDLE shell or output windows (GH-16939)
    e3a477a

    @taleinat
    Copy link
    Contributor

    As a better design for a long-term fix, I suggest:

    • Avoiding isinstance() checks by instead using a dedicated class attribute and checking that. (I've recently used this pattern for line numbers.)
    • Instead of baling out inside the "check module" and "run" handlers, don't include the related items in the menus in the first place. (Make them conditional on the above-mentioned class attribute's value.)

    @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 3.8 only security fixes 3.9 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants