Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pypy pypy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 655
    • Issues 655
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyPy
  • pypypypy
  • Merge requests
  • !730

Merged
Created Jun 18, 2020 by Yannick Jadoul@YannickJadoulMaintainer

Implement bpo-30465: Fix lineno and col_offset in fstring AST nodes

  • Overview 12
  • Commits 4
  • Pipelines 6
  • Changes 4

Fixes the lineno- and col_offset-related failures on in lib-python/3/test/test_fstring.py.

See https://bugs.python.org/issue30465 and https://github.com/python/cpython/pull/1800

Also fixes the test_ast_line_numbers_multiline_fstring test to match https://github.com/python/cpython/pull/10021, since the issue solved in this CPython PR (and only available from CPython 3.8 onwards; see https://bugs.python.org/issue16806) is already handled correctly by PyPy.

I still don't fully get why in this test

    def test_ast_mutiline_lineno_and_col_offset(self):
        m = ast.parse("\n\nf'''{x}\nabc{y}\n{\nz}'''   \n\n\n")
        x_ast = m.body[0].value.values[0].value
        y_ast = m.body[0].value.values[2].value
        z_ast = m.body[0].value.values[4].value
        assert x_ast.lineno == 3
        assert x_ast.col_offset == 5
        assert y_ast.lineno == 4
        assert y_ast.col_offset == 5
        assert z_ast.lineno == 6
        assert z_ast.col_offset == 0

y_ast.col_offset is 5 and not 4, but it's consistent with CPython 3.8, so there's probably something I'm missing.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: topic/py3.6/py3.6-bpo-30465