Skip to content

Empty unclosed f-string does not directly raise a SyntaxError in the REPL #103727

Description

@lysnikolaou

Bug report

This is another bug introduced in 1ef61cf. When typing an empty single-quoted unclosed f-string in the REPL, another line is added and input is expected, before a SyntaxError is raised.

Before 1ef61cf:

❯ ./python.exe 
Python 3.12.0a7+ (tags/v3.12.0a7-153-ga6b07b5a34:a6b07b5a34, Apr 23 2023, 13:18:40) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> f'
  File "<stdin>", line 1
    f'
    ^
SyntaxError: unterminated string literal (detected at line 1)

Current main:

❯ ./python.exe 
Python 3.12.0a7+ (heads/main:05b3ce7339, Apr 23 2023, 13:26:24) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> f"
... 
  File "<stdin>", line 1
    f"
    ^
SyntaxError: unterminated f-string literal (detected at line 2)
>>> f"
... asdnc
  File "<stdin>", line 1
    f"
    ^
SyntaxError: unterminated f-string literal (detected at line 2)
>>> f"
... asdasd"
  File "<stdin>", line 1
    f"
    ^
SyntaxError: unterminated f-string literal (detected at line 2)

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions