I know and agree. String literals are not comments. It is highly unfortunate that there is a substantial amount of code that is improperly treating them as such, though. This is the reality.
I want to point out a few issues with the current plan.
How it will work when a new escape sequence is added (assuming that it does not act like \U) is we will have this issue with code, let’s say it’s \e.
Here, we have this problem of continuity. The same code will go from warning → error → no error in 3 different versions.
Specifically, the current plan will work like so:
Python 3.A: syntax warning. Code still functions, in that it can be run.
Python 3.B: Invalid escapes result in syntax errors. Code will not run, regardless of how benign the escape is on the code’s core functionality
Python 3.C. \e is added as an escape. The code now functions as before, except that the \e will be rendered differently. This behavior may or may not be benign (e.g. file paths will be modified entirely).
I personally don’t think this is meaningfully better than warning → no error. It is especially not worth having these codebases break between python versions 3.B and 3.C.
That is, the warning should be sufficient! You as python developers have done your due diligence by communicating to users that their code may not work as expected in the future with the syntax warning. This never needs to escalate to an error.
You are not silently breaking code. You made so much noise with the warnings that have been communicated ever since Python 3.6.
Also, I know firsthand that people in these communities don’t increment python versions with every new number. E.g., one project I am aware of began in 3.6, went to 3.8, and now uses 3.11.
This upgrade to an error will not even prevent all cases.