mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +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
|
@ -6065,6 +6065,9 @@ PyUnicode_DecodeUnicodeEscape(const char *s,
|
|||
goto error;
|
||||
|
||||
default:
|
||||
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
|
||||
"invalid escape sequence '\\%c'", c) < 0)
|
||||
goto onError;
|
||||
WRITE_ASCII_CHAR('\\');
|
||||
WRITE_CHAR(c);
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue