bpo-32912: Revert SyntaxWarning on invalid escape sequences. (GH-15195)

DeprecationWarning will continue to be emitted for invalid escape
sequences in string and bytes literals just as it did in 3.7.

SyntaxWarning may be emitted in the future. But per mailing list
discussion, we don't yet know when because we haven't settled on how to
do so in a non-disruptive manner.

(Applies 4c5b6bac24 to the master branch).
(This is https://github.com/python/cpython/pull/15142 for master/3.9)


https://bugs.python.org/issue32912



Automerge-Triggered-By: @gpshead
This commit is contained in:
Gregory P. Smith 2019-08-10 00:19:07 -07:00 committed by Miss Islington (bot)
parent 92c7e30adf
commit b4be87a04a
6 changed files with 43 additions and 18 deletions

View file

@ -649,7 +649,7 @@ non-important content
self.assertEqual(f'2\x203', '2 3')
self.assertEqual(f'\x203', ' 3')
with self.assertWarns(SyntaxWarning): # invalid escape sequence
with self.assertWarns(DeprecationWarning): # invalid escape sequence
value = eval(r"f'\{6*7}'")
self.assertEqual(value, '\\42')
self.assertEqual(f'\\{6*7}', '\\42')