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

Parse error when missing commas is inconsistent #89890

Closed
cfbolz mannequin opened this issue Nov 5, 2021 · 6 comments
Closed

Parse error when missing commas is inconsistent #89890

cfbolz mannequin opened this issue Nov 5, 2021 · 6 comments
Labels
3.11 only security fixes

Comments

@cfbolz
Copy link
Mannequin

cfbolz mannequin commented Nov 5, 2021

BPO 45727
Nosy @cfbolz, @pablogsal, @AlexWaygood
PRs
  • bpo-45727: Make the syntax error for missing comma more consistent #29427
  • [3.10] bpo-45727: Make the syntax error for missing comma more consistent (GH-29427) #29647
  • bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses #29757
  • [3.10] bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses. #29767
  • 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-11-20.18:08:07.592>
    created_at = <Date 2021-11-05.12:44:08.998>
    labels = ['3.11']
    title = 'Parse error when missing commas is inconsistent'
    updated_at = <Date 2021-11-25.01:01:50.150>
    user = 'https://github.com/cfbolz'

    bugs.python.org fields:

    activity = <Date 2021-11-25.01:01:50.150>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-11-20.18:08:07.592>
    closer = 'pablogsal'
    components = []
    creation = <Date 2021-11-05.12:44:08.998>
    creator = 'Carl.Friedrich.Bolz'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45727
    keywords = ['patch']
    message_count = 6.0
    messages = ['405792', '405794', '406625', '406676', '406968', '406972']
    nosy_count = 3.0
    nosy_names = ['Carl.Friedrich.Bolz', 'pablogsal', 'AlexWaygood']
    pr_nums = ['29427', '29647', '29757', '29767']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue45727'
    versions = ['Python 3.11']

    @cfbolz
    Copy link
    Mannequin Author

    cfbolz mannequin commented Nov 5, 2021

    I found following inconsistency in the error message when there's a missing comma (it behaves that way both on main and 3.10).

    Here's what happens with numbers, as expected:

    Python 3.11.0a1+ (heads/main:32f55d1a5d, Nov  5 2021, 13:18:52) [GCC 11.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 1 2 3 4
      File "<stdin>", line 1
        1 2 3 4
        ^^^
    SyntaxError: invalid syntax. Perhaps you forgot a comma?

    But with names the error is further right in the lines:

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

    That looks potentially quite confusing to me?

    (I don't know if these nit-picky parsing issues are too annoying, if they are please tell me to stop filing them).

    @cfbolz cfbolz mannequin added 3.11 only security fixes labels Nov 5, 2021
    @pablogsal
    Copy link
    Member

    (I don't know if these nit-picky parsing issues are too annoying, if they are please tell me to stop filing them).

    Don't worry, I think is great to discuss these cases. If there are too many, then maybe it will take a while to correct, but please, don't stop :)

    That looks potentially quite confusing to me?

    I agree is unfortunate that is inconsistent, but unfortunately, this is going to be a bit of a pain because the way the expression rule is reached. I will try to see if we can easily fix this without having to restructure a bunch of the grammar

    @pablogsal
    Copy link
    Member

    New changeset 546cefc by Pablo Galindo Salgado in branch 'main':
    bpo-45727: Make the syntax error for missing comma more consistent (GH-29427)
    546cefc

    @pablogsal
    Copy link
    Member

    New changeset 511ee1c by Pablo Galindo Salgado in branch '3.10':
    [3.10] bpo-45727: Make the syntax error for missing comma more consistent (GH-29427) (GH-29647)
    511ee1c

    @pablogsal
    Copy link
    Member

    New changeset 24c10d2 by Pablo Galindo Salgado in branch 'main':
    bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses (GH-29757)
    24c10d2

    @pablogsal
    Copy link
    Member

    New changeset c72311d by Pablo Galindo Salgado in branch '3.10':
    [3.10] bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses. (GH-29767)
    c72311d

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

    No branches or pull requests

    1 participant