Skip to content

Parser: broken line numbers for triple-quoted strings #68811

Closed

Description

@skrah
mannequin
BPO 24623
Nosy @vstinner, @benjaminp, @skrah, @serhiy-storchaka
Superseder
  • bpo-16806: col_offset is -1 and lineno is wrong for multiline string expressions
  • 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 2015-11-16.15:24:15.843>
    created_at = <Date 2015-07-12.19:41:18.818>
    labels = []
    title = 'Parser: broken line numbers for triple-quoted strings'
    updated_at = <Date 2015-11-16.15:24:15.841>
    user = 'https://github.com/skrah'

    bugs.python.org fields:

    activity = <Date 2015-11-16.15:24:15.841>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-11-16.15:24:15.843>
    closer = 'serhiy.storchaka'
    components = []
    creation = <Date 2015-07-12.19:41:18.818>
    creator = 'skrah'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 24623
    keywords = []
    message_count = 3.0
    messages = ['246665', '254116', '254738']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'benjamin.peterson', 'skrah', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '16806'
    type = None
    url = 'https://bugs.python.org/issue24623'
    versions = []

    Activity

    1. skrah commented on Jul 12, 2015

      skrahmannequin
      MannequinAuthor

      IMO the string should start at lineno=1, col_offset=0.

      $ ./python 
      Python 3.6.0a0 (default:02b81a82a57d, Jul 12 2015, 20:33:44) 
      [GCC 4.8.4] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import ast
      >>> a = ast.parse('''"""xxx
      ... yyy
      ... zzz"""''')
      >>> ast.dump(a, include_attributes=True)
      "Module(body=[Expr(value=Str(s='xxx\\nyyy\\nzzz', lineno=3, col_offset=-1), lineno=3, col_offset=-1)])"
    2. skrah commented on Nov 5, 2015

      skrahmannequin
      MannequinAuthor

      Victor, I'm adding you just in case this also affects your
      optimizer (like bpo-25555).

    3. serhiy-storchaka commented on Nov 16, 2015

      @serhiy-storchaka
      Member

      This is a duplicate of bpo-16806

    4. 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

      No labels
      No labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions