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 syntax errors for missing commas #87988

Closed
pablogsal opened this issue Apr 13, 2021 · 4 comments
Closed

Improve syntax errors for missing commas #87988

pablogsal opened this issue Apr 13, 2021 · 4 comments

Comments

@pablogsal
Copy link
Member

BPO 43822
Nosy @pablogsal, @miss-islington
PRs
  • bpo-43822: Improve syntax errors for missing commas #25377
  • bpo-43822: When reporting parser custom errors, check first for tokenizer errors #25866
  • [3.10] bpo-43822: Prioritize tokenizer errors over custom syntax errors when raising parser exceptions (GH-25866) #25869
  • [3.10] bpo-43822: Prioritize tokenizer errors over custom syntax errors when raising parser exceptions (GH-25866) #25870
  • 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-04-15.22:07:56.465>
    created_at = <Date 2021-04-13.01:30:43.793>
    labels = []
    title = 'Improve syntax errors for missing commas'
    updated_at = <Date 2021-07-18.15:31:01.858>
    user = 'https://github.com/pablogsal'

    bugs.python.org fields:

    activity = <Date 2021-07-18.15:31:01.858>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-04-15.22:07:56.465>
    closer = 'pablogsal'
    components = []
    creation = <Date 2021-04-13.01:30:43.793>
    creator = 'pablogsal'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43822
    keywords = ['patch']
    message_count = 4.0
    messages = ['390916', '391152', '392846', '392847']
    nosy_count = 2.0
    nosy_names = ['pablogsal', 'miss-islington']
    pr_nums = ['25377', '25866', '25869', '25870']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue43822'
    versions = []

    @pablogsal
    Copy link
    Member Author

    Given that is quite common to forgot a comma in containers, function calls, ...etc and that the current error is:

    >>> [a, b, c d]
      File "<stdin>", line 1
        [a, b, c d]
                 ^
    SyntaxError: invalid syntax

    We could improve the user experience quite a lot if we mention that probably the user forgot a comma:

    >>> [a, b, c d]
      File "<stdin>", line 1
        [a, b, c d]
                 ^
    SyntaxError: invalid syntax. Perhaps you forgot a comma?

    @pablogsal
    Copy link
    Member Author

    New changeset b280248 by Pablo Galindo in branch 'master':
    bpo-43822: Improve syntax errors for missing commas (GH-25377)
    b280248

    @miss-islington
    Copy link
    Contributor

    New changeset 756b7b9 by Miss Islington (bot) in branch '3.10':
    bpo-43822: Prioritize tokenizer errors over custom syntax errors when raising parser exceptions (GH-25866)
    756b7b9

    @miss-islington
    Copy link
    Contributor

    New changeset d1ff838 by Miss Islington (bot) in branch '3.10':
    bpo-43822: Prioritize tokenizer errors over custom syntax errors when raising parser exceptions (GH-25866)
    d1ff838

    @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
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants