mirror of
https://github.com/python/cpython.git
synced 2025-12-09 18:48:05 +00:00
#27364: Deprecate invalid escape strings in str/byutes.
Patch by Emanuel Barry, reviewed by Serhiy Storchaka and Martin Panter.
This commit is contained in:
parent
186122ead2
commit
110b6fecbb
7 changed files with 48 additions and 12 deletions
|
|
@ -1207,8 +1207,9 @@ PyObject *PyBytes_DecodeEscape(const char *s,
|
|||
break;
|
||||
|
||||
default:
|
||||
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "invalid escape sequence '\\%c'", *(--s)) < 0)
|
||||
goto failed;
|
||||
*p++ = '\\';
|
||||
s--;
|
||||
goto non_esc; /* an arbitrary number of unescaped
|
||||
UTF-8 bytes may follow. */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue