gh-128016: Improved invalid escape sequence warning message (#128020)
This commit is contained in:
@@ -6853,7 +6853,8 @@ _PyUnicode_DecodeUnicodeEscapeStateful(const char *s,
|
||||
unsigned char c = *first_invalid_escape;
|
||||
if ('4' <= c && c <= '7') {
|
||||
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
|
||||
"invalid octal escape sequence '\\%.3s'",
|
||||
"\"\\%.3s\" is an invalid octal escape sequence. "
|
||||
"Such sequences will not work in the future. ",
|
||||
first_invalid_escape) < 0)
|
||||
{
|
||||
Py_DECREF(result);
|
||||
@@ -6862,7 +6863,8 @@ _PyUnicode_DecodeUnicodeEscapeStateful(const char *s,
|
||||
}
|
||||
else {
|
||||
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
|
||||
"invalid escape sequence '\\%c'",
|
||||
"\"\\%c\" is an invalid escape sequence. "
|
||||
"Such sequences will not work in the future. ",
|
||||
c) < 0)
|
||||
{
|
||||
Py_DECREF(result);
|
||||
|
||||
Reference in New Issue
Block a user