Skip to content

IDLE doesn't know where to start parsing #124451

@ujan-r

Description

@ujan-r

Bug report

Bug description:

After making a typo in IDLE, I noticed some unexpected calltips and incorrectly matched parentheses. These seem to be caused by the parser not knowing where the current prompt begins. I'll try to send in a PR tonight.

Examples

Parentheses are incorrectly matched:

>>> (1 2
...
SyntaxError: '(' was never closed
>>> ) # IDLE highlights this as the closing paren

Matching parentheses aren't detected (from #85560):

>>> (1 if 0
     else 0) # IDLE beeps here, not detecting the opening paren

Calltip appears unexpectedly (Python 3.12; a new error message hides this issue in the latest version):

>>> (1 2
...
SyntaxError: incomplete input
>>> ( # this opens the calltip for `input`

CPython versions tested on:

3.12, CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-IDLEtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions