diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-10-19 14:42:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 14:42:06 (GMT) |
commit | 6543912c90ffa579dc4c01e811f9609cf92197d3 (patch) | |
tree | 44f433f463ad6624814d0f3c556501eeefb862b8 /Python/ast.c | |
parent | 209144831b0a19715bda3bd72b14a3e6192d9cc1 (diff) | |
download | cpython-6543912c90ffa579dc4c01e811f9609cf92197d3.zip cpython-6543912c90ffa579dc4c01e811f9609cf92197d3.tar.gz cpython-6543912c90ffa579dc4c01e811f9609cf92197d3.tar.bz2 |
bpo-32912: Replace a DeprecationWarning with a SyntaxWarning (GH-9652)
for invalid escape sequences in string and bytes literals.
Diffstat (limited to 'Python/ast.c')
-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 587f838..184e33b 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -4128,14 +4128,14 @@ warn_invalid_escape_sequence(struct compiling *c, const node *n, if (msg == NULL) { return -1; } - if (PyErr_WarnExplicitObject(PyExc_DeprecationWarning, msg, + if (PyErr_WarnExplicitObject(PyExc_SyntaxWarning, msg, c->c_filename, LINENO(n), NULL, NULL) < 0) { - if (PyErr_ExceptionMatches(PyExc_DeprecationWarning)) { + if (PyErr_ExceptionMatches(PyExc_SyntaxWarning)) { const char *s; - /* Replace the DeprecationWarning exception with a SyntaxError + /* Replace the SyntaxWarning exception with a SyntaxError to get a more accurate error report */ PyErr_Clear(); |