mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
gh-128016: Improved invalid escape sequence warning message (#128020)
This commit is contained in:
parent
40a4d88a14
commit
8d8b854824
9 changed files with 63 additions and 25 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue