Skip to content

Raw string of r'\' incorrectly being flagged as SyntaxError: unterminated string literal #129537

@Loki-waterAIC

Description

@Loki-waterAIC

Bug report

Bug description:

# Add a code block here, if required
Python 3.13.1 (tags/v3.13.1:0671451, Dec  3 2024, 19:06:28) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
r'\'
SyntaxError: unterminated string literal (detected at line 1); perhaps you escaped the end quote?

The raw string of the single character '' incorrectly gets flagged as an unterminated string when both opening and closing quotations are present.

This also occurs in 3.12, 3.13; both on windows and linux.

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    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