Commit a5618620 authored by Serhiy Storchaka's avatar Serhiy Storchaka Committed by GitHub

Don't hide unexpected errors in PyErr_WarnExplicitObject(). (#4585)

parent 73a7e9b1
......@@ -4160,9 +4160,9 @@ warn_invalid_escape_sequence(struct compiling *c, const node *n,
}
if (PyErr_WarnExplicitObject(PyExc_DeprecationWarning, msg,
c->c_filename, LINENO(n),
NULL, NULL) < 0 &&
PyErr_ExceptionMatches(PyExc_DeprecationWarning))
NULL, NULL) < 0)
{
if (PyErr_ExceptionMatches(PyExc_DeprecationWarning)) {
const char *s;
/* Replace the DeprecationWarning exception with a SyntaxError
......@@ -4173,6 +4173,7 @@ warn_invalid_escape_sequence(struct compiling *c, const node *n,
if (s != NULL) {
ast_error(c, n, s);
}
}
Py_DECREF(msg);
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment