mirror of
https://github.com/python/cpython.git
synced 2025-09-30 04:15:43 +00:00
Don't hide unexpected errors in PyErr_WarnExplicitObject(). (GH-4585) (#4662)
(cherry picked from commit a561862048
)
This commit is contained in:
parent
8bcd41040a
commit
9881e4e538
1 changed files with 10 additions and 9 deletions
|
@ -4136,9 +4136,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
|
||||
|
@ -4149,6 +4149,7 @@ warn_invalid_escape_sequence(struct compiling *c, const node *n,
|
|||
if (s != NULL) {
|
||||
ast_error(c, n, s);
|
||||
}
|
||||
}
|
||||
Py_DECREF(msg);
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue