Skip to content

File and lineno is not reported for syntax error in f-string #81246

Closed

Description

@ods
mannequin
BPO 37065
Nosy @ods, @ericvsmith, @tirkarthi
Superseder
  • bpo-34364: problem with traceback for syntax error in f-string
  • 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 = 'https://github.com/ericvsmith'
    closed_at = <Date 2019-05-27.17:48:33.640>
    created_at = <Date 2019-05-27.15:11:54.021>
    labels = ['interpreter-core', '3.8', 'type-bug', '3.7']
    title = 'File and lineno is not reported for syntax error in f-string'
    updated_at = <Date 2019-05-27.17:48:33.639>
    user = 'https://github.com/ods'

    bugs.python.org fields:

    activity = <Date 2019-05-27.17:48:33.639>
    actor = 'SilentGhost'
    assignee = 'eric.smith'
    closed = True
    closed_date = <Date 2019-05-27.17:48:33.640>
    closer = 'SilentGhost'
    components = ['Interpreter Core']
    creation = <Date 2019-05-27.15:11:54.021>
    creator = 'ods'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37065
    keywords = []
    message_count = 3.0
    messages = ['343639', '343656', '343657']
    nosy_count = 3.0
    nosy_names = ['ods', 'eric.smith', 'xtreak']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '34364'
    type = 'behavior'
    url = 'https://bugs.python.org/issue37065'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    Activity

    1. ods commented on May 27, 2019

      odsmannequin
      MannequinAuthor

      Minimal example to reproduce:

      -->8--
      >>> with open('f_bug.py', 'w') as fp:
      ...     fp.write('f"{a b}"')
      ... 
      8
      >>> import f_bug
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "<fstring>", line 1
          (a b)
             ^
      SyntaxError: invalid syntax
      -->8--

      Here we see in track trace "<fstring>" and line number in erroneous expression in f-string, but no "f_bug.py" and line number in it.

    2. added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      type-bugAn unexpected behavior, bug, or error
      on May 27, 2019
    3. ericvsmith commented on May 27, 2019

      @ericvsmith
      Member

      I'm pretty sure there's already an issue for this, but I don't have time to search for it now.

      This is not an easy problem to solve. I've been working on it on and off for almost a year. I'll eventually get to it, but the changes are pretty invasive.

    4. self-assigned this
      on May 27, 2019
    5. tirkarthi commented on May 27, 2019

      @tirkarthi
      Member

      Related open issue : bpo-34364. Also bpo-29051 which was closed as duplicate of bpo-34364.

    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

    Labels

    3.7 (EOL)end of life3.8 (EOL)end of lifeinterpreter-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