#27364: Deprecate invalid escape strings in str/byutes.

Patch by Emanuel Barry, reviewed by Serhiy Storchaka and Martin Panter.
This commit is contained in:
R David Murray 2016-09-08 15:34:08 -04:00
parent 186122ead2
commit 110b6fecbb
7 changed files with 48 additions and 12 deletions

View file

@ -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;