-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Invalid escape sequences raise SyntaxWarning #119458
Comments
That has nothing to be with PEP 701. PEP 701 is about f-strings, not about strings in general. That change was introduced here: |
The referenced commit is about octal sequences above 0o377. The warning results from changing the invalid escape sequence warning from DeprecationWarning (usually invisible) to SyntaxWarning (usually visible, but not currently in IDLE and other possible circumstances) in 3.12 in issue #98401, PR #99011. The same warning occurs with The change was in 3.12.0 and noted in What' New 3.12:
If you want a single backslash in the string, either double it or precede the string with 'r': |
Ahh ok that explains everything. I got this Error because Mathematica’s ExternalEvaluate uses an invalid escape sequence and I knew that in march all was working fine. I regularly update my system so I thought I was using python version 3.12.2 in march. But it turns out that Archlinux doesn’t update their python package that often, therefore I was using version 3.11.8 instead. |
PEP 701 introduced with python version 3.12.3 claims to be backwards compatible.
But in python version 3.12.2 the string "\.00" gives \\.00 and since python version 3.12.3 I get the follwing error:
<stdin>:1: SyntaxWarning: invalid escape sequence '\.'
'\\.00'
The text was updated successfully, but these errors were encountered: