diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-11-15 08:12:36 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-11-15 08:12:36 (GMT) |
commit | d5f599a39270b4fd791f7e0190bede9911bb0e52 (patch) | |
tree | cc60c07976aa6eb1b180427c2a8bacc878efc7db /Python | |
parent | 9ee351fc1ee318199931028b8bcfff4954dd01f5 (diff) | |
parent | f9cca365c72eaa932f1bee6407fbbbc3b4ed96f0 (diff) | |
download | cpython-d5f599a39270b4fd791f7e0190bede9911bb0e52.zip cpython-d5f599a39270b4fd791f7e0190bede9911bb0e52.tar.gz cpython-d5f599a39270b4fd791f7e0190bede9911bb0e52.tar.bz2 |
Merge 3.6
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c index bfae6ed..14bcdb1 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -4129,7 +4129,13 @@ warn_invalid_escape_sequence(struct compiling *c, const node *n, NULL, NULL) < 0 && PyErr_ExceptionMatches(PyExc_DeprecationWarning)) { - const char *s = PyUnicode_AsUTF8(msg); + const char *s; + + /* Replace the DeprecationWarning exception with a SyntaxError + to get a more accurate error report */ + PyErr_Clear(); + + s = PyUnicode_AsUTF8(msg); if (s != NULL) { ast_error(c, n, s); } |