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

Improve error messages regarding unclosed parentheses #87030

Closed
pablogsal opened this issue Jan 8, 2021 · 4 comments
Closed

Improve error messages regarding unclosed parentheses #87030

pablogsal opened this issue Jan 8, 2021 · 4 comments
Labels
3.10 only security fixes

Comments

@pablogsal
Copy link
Member

BPO 42864
Nosy @lysnikolaou, @pablogsal, @miss-islington
PRs
  • bpo-42864: Improve error messages regarding unclosed parentheses #24161
  • bpo-42864: Fix compiler warning in tokenizer.c with the new paren stack for column numbers #24266
  • bpo-42864: Simplify the tokenizer exceptions after generic SyntaxError #24273
  • 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 = None
    closed_at = <Date 2021-01-20.00:07:04.832>
    created_at = <Date 2021-01-08.03:03:30.904>
    labels = ['3.10']
    title = 'Improve error messages regarding unclosed parentheses'
    updated_at = <Date 2021-01-20.19:12:05.406>
    user = 'https://github.com/pablogsal'

    bugs.python.org fields:

    activity = <Date 2021-01-20.19:12:05.406>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-01-20.00:07:04.832>
    closer = 'pablogsal'
    components = []
    creation = <Date 2021-01-08.03:03:30.904>
    creator = 'pablogsal'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42864
    keywords = ['patch']
    message_count = 4.0
    messages = ['384630', '385307', '385338', '385362']
    nosy_count = 3.0
    nosy_names = ['lys.nikolaou', 'pablogsal', 'miss-islington']
    pr_nums = ['24161', '24266', '24273']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue42864'
    versions = ['Python 3.10']

    @pablogsal
    Copy link
    Member Author

    Consider this file:

    x = (
    
    
    

    The error that we get is:

    ❯ python ../a.py
    File "/home/pablogsal/github/python/master/../a.py", line 6

    ^
    

    SyntaxError: unexpected EOF while parsin

    This is quite uninformative of the actual problem, which is the closed parentheses.

    The same happens with something like this:

    ( 1+2

    File "/home/pablogsal/github/python/master/lel.py", line 3

    ^
    

    SyntaxError: unexpected EOF while parsing

    With some effort, we can include the location of the unclosed parentheses.

    @pablogsal pablogsal added 3.10 only security fixes labels Jan 8, 2021
    @pablogsal
    Copy link
    Member Author

    New changeset d6d6371 by Pablo Galindo in branch 'master':
    bpo-42864: Improve error messages regarding unclosed parentheses (GH-24161)
    d6d6371

    @pablogsal
    Copy link
    Member Author

    New changeset ae7d3cd by Pablo Galindo in branch 'master':
    bpo-42864: Fix compiler warning in the tokenizer with the new paren stack for column numbers (GH-24266)
    ae7d3cd

    @miss-islington
    Copy link
    Contributor

    New changeset c3f167d by Pablo Galindo in branch 'master':
    bpo-42864: Simplify the tokenizer exceptions after generic SyntaxError (GH-24273)
    c3f167d

    @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.10 only security fixes
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants