Skip to content

ast.parse produces wrong lineno and col_offset for triple-quoted strings #62570

Closed

Description

@aivarannamaa
BPO 18370
Nosy @aivarannamaa
Superseder
  • bpo-16806: col_offset is -1 and lineno is wrong for multiline string expressions
  • Files
  • col_offset_bug.py: reproduces the bug
  • 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 2013-07-06.09:44:32.541>
    created_at = <Date 2013-07-05.20:24:05.916>
    labels = ['interpreter-core', 'type-bug']
    title = 'ast.parse produces wrong lineno and col_offset for triple-quoted strings'
    updated_at = <Date 2013-07-06.16:51:43.181>
    user = 'https://github.com/aivarannamaa'

    bugs.python.org fields:

    activity = <Date 2013-07-06.16:51:43.181>
    actor = 'brett.cannon'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-07-06.09:44:32.541>
    closer = 'Aivar.Annamaa'
    components = ['Interpreter Core']
    creation = <Date 2013-07-05.20:24:05.916>
    creator = 'Aivar.Annamaa'
    dependencies = []
    files = ['30784']
    hgrepos = []
    issue_num = 18370
    keywords = []
    message_count = 3.0
    messages = ['192355', '192359', '192395']
    nosy_count = 1.0
    nosy_names = ['Aivar.Annamaa']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '16806'
    type = 'behavior'
    url = 'https://bugs.python.org/issue18370'
    versions = ['Python 3.1', 'Python 3.2', 'Python 3.3']

    Activity

    1. aivarannamaa commented on Jul 5, 2013

      aivarannamaamannequin
      MannequinAuthor

      AST nodes for triple-quoted strings have -1 in col_offset field, as presented in the attached file.

    2. added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      type-bugAn unexpected behavior, bug, or error
      on Jul 5, 2013
    3. aivarannamaa commented on Jul 5, 2013

      aivarannamaamannequin
      MannequinAuthor

      Didn't notice before: the lineno attribute is also wrong

    4. changed the title [-]ast.parse produces -1 as col_offset for triple-quoted strings[/-] [+]ast.parse produces wrong lineno and col_offset for triple-quoted strings[/+] on Jul 5, 2013
    5. aivarannamaa commented on Jul 6, 2013

      aivarannamaamannequin
      MannequinAuthor

      Seems this issue is a duplicate of http://bugs.python.org/issue16806

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions