Skip to content

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

@lysnikolaou

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.exePython3.12.0a7+ (tags/v3.12.0a7-153-ga6b07b5a34:a6b07b5a34, Apr232023, 13:18:40) [Clang14.0.3 (clang-1403.0.22.14.1)] ondarwinType"help", "copyright", "credits"or"license"formoreinformation. >>> f' File"<stdin>", line1 f' ^SyntaxError: unterminatedstringliteral (detectedatline1)

Current main:

❯ ./python.exePython3.12.0a7+ (heads/main:05b3ce7339, Apr232023, 13:26:24) [Clang14.0.3 (clang-1403.0.22.14.1)] ondarwinType"help", "copyright", "credits"or"license"formoreinformation. >>> f" ... File"<stdin>", line1 f" ^SyntaxError: unterminatedf-stringliteral (detectedatline2) >>> f" ... asdncFile"<stdin>", line1 f" ^SyntaxError: unterminatedf-stringliteral (detectedatline2) >>>f"... asdasd"File"<stdin>", line1 f" ^SyntaxError: unterminatedf-stringliteral (detectedatline2)

Linked PRs

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