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

syntax errors on continuation lines #43468

Closed
rcmiller mannequin opened this issue Jun 7, 2006 · 6 comments
Closed

syntax errors on continuation lines #43468

rcmiller mannequin opened this issue Jun 7, 2006 · 6 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@rcmiller
Copy link
Mannequin

rcmiller mannequin commented Jun 7, 2006

BPO 1501979
Nosy @birkenfeld
Files
  • continuation_syntax_error.diff: Patch for syntax errors on continuation lines
  • 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 2010-07-19.22:25:44.523>
    created_at = <Date 2006-06-07.02:49:17.000>
    labels = ['interpreter-core', 'type-feature']
    title = 'syntax errors on continuation lines'
    updated_at = <Date 2010-07-19.22:25:44.522>
    user = 'https://bugs.python.org/rcmiller'

    bugs.python.org fields:

    activity = <Date 2010-07-19.22:25:44.522>
    actor = 'BreamoreBoy'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-07-19.22:25:44.523>
    closer = 'BreamoreBoy'
    components = ['Interpreter Core']
    creation = <Date 2006-06-07.02:49:17.000>
    creator = 'rcmiller'
    dependencies = []
    files = ['7316']
    hgrepos = []
    issue_num = 1501979
    keywords = ['patch']
    message_count = 6.0
    messages = ['50438', '50439', '50440', '84825', '110452', '110817']
    nosy_count = 4.0
    nosy_names = ['georg.brandl', 'sonderblade', 'rcmiller', 'BreamoreBoy']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1501979'
    versions = ['Python 3.1', 'Python 2.7']

    @rcmiller
    Copy link
    Mannequin Author

    rcmiller mannequin commented Jun 7, 2006

    This patch modifies syntax error location information
    to indicate when an error is detected on a statement
    continuation line, for example
    File "test.py", line 42 (continuing line 41)
    The intent is to be less confusing when an error
    reported on one line is actually the result of
    unbalanced brackets on a previous line. The change
    adds a new 'stmt_lineno' field to the SyntaxError
    exception, containing the line number on which the
    statement started.

    The patch is against r46701 and was developed and
    tested on Fedora 4 Linux.

    @rcmiller rcmiller mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Jun 7, 2006
    @birkenfeld
    Copy link
    Member

    Logged In: YES
    user_id=849994

    Note that you cannot give a "|" inside a tuple specification
    in PyArg_ParseTuple.

    @sonderblade
    Copy link
    Mannequin

    sonderblade mannequin commented Mar 12, 2007

    Works nicely:

    >>> (3,
    ... 8,
    ... 4 +,
      File "<stdin>", line 3 (continuing line 1)
        4 +,
           ^
    SyntaxError: invalid syntax

    The patch does not apply cleanly because of changes in traceback.py, but it is easy to fix. But IMHO, the special casing that checks for the presence of the extra stmt_lineno attribute is not nice at all. I think it would be better if stmt_lineno always was included and equal to lineno in the normal case. Then traceback.py would just check if stmt_lineno differs from lineno, and if so, append the extra '(continuing line %d)' information.

    @devdanzin devdanzin mannequin added type-feature A feature request or enhancement labels Mar 21, 2009
    @birkenfeld
    Copy link
    Member

    I'm not sure if this is necessary; you could argue that the syntax error
    really is on the last line, because there the parenthesis is missing.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 16, 2010

    msg84825 asks if this is necessary. Strikes me as being six of one, half a dozen of the other. As few people have shown any interest I'm inclined to close this unless someone pops out of the woodwork.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 19, 2010

    Closing as noone has responded.

    @BreamoreBoy BreamoreBoy mannequin closed this as completed Jul 19, 2010
    @BreamoreBoy BreamoreBoy mannequin closed this as completed Jul 19, 2010
    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant