diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-08-09 22:34:22 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2019-08-09 22:34:22 (GMT) |
commit | 4c5b6bac2408f879231c7cd38d67657dd4804e7c (patch) | |
tree | 71c68d4bea17e42da6f071920c48c2492c77fe38 /Python | |
parent | 217077440a6938a0b428f67cfef6e053c4f8673c (diff) | |
download | cpython-4c5b6bac2408f879231c7cd38d67657dd4804e7c.zip cpython-4c5b6bac2408f879231c7cd38d67657dd4804e7c.tar.gz cpython-4c5b6bac2408f879231c7cd38d67657dd4804e7c.tar.bz2 |
[3.8] bpo-32912: Revert SyntaxWarning on invalid escape sequences (GH-15142)
* bpo-32912: Revert warnings for invalid escape sequences.
DeprecationWarning will continue to be emitted for invalid escape sequences in string and bytes literals in 3.8 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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/ast.c b/Python/ast.c index f6c2049..9947824 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -4674,12 +4674,12 @@ warn_invalid_escape_sequence(struct compiling *c, const node *n, if (msg == NULL) { return -1; } - if (PyErr_WarnExplicitObject(PyExc_SyntaxWarning, msg, + if (PyErr_WarnExplicitObject(PyExc_DeprecationWarning, msg, c->c_filename, LINENO(n), NULL, NULL) < 0) { - if (PyErr_ExceptionMatches(PyExc_SyntaxWarning)) { - /* Replace the SyntaxWarning exception with a SyntaxError + if (PyErr_ExceptionMatches(PyExc_DeprecationWarning)) { + /* Replace the DeprecationWarning exception with a SyntaxError to get a more accurate error report */ PyErr_Clear(); ast_error(c, n, "%U", msg); |