10000 Python3 erroneously calls r'\' a syntax error · Issue #103704 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Python3 erroneously calls r'\' a syntax error #103704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
greg1lutz opened this issue Apr 23, 2023 · 3 comments
Closed

Python3 erroneously calls r'\' a syntax error #103704

greg1lutz opened this issue Apr 23, 2023 · 3 comments

Comments

@greg1lutz
Copy link
greg1lutz commented Apr 23, 2023

The Python 3.11.3 interpreter, upon seeing the expression
r'\'
emits the message
SyntaxError: unterminated string literal

@hauntsaninja
Copy link
Contributor
hauntsaninja commented Apr 23, 2023

Thanks, but this isn't a bug.

This is documented at this FAQ: https://docs.python.org/3/faq/programming.html#can-i-end-a-raw-string-with-an-odd-number-of-backslashes

It's also mentioned at https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals

(we recently improved the docs for this in #94768 )

@hauntsaninja hauntsaninja closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2023
@terryjreedy
Copy link
Member

@greg1lutz Please ask whether behaviors are bugs on the discuss help channel.

@hauntsaninja
Copy link
Contributor
hauntsaninja commented Apr 24, 2023

Oh one more note is that I'd opened #100446 to explore ways to improve the error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0