diff options
author | R David Murray <rdmurray@bitdance.com> | 2016-09-08 19:34:08 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2016-09-08 19:34:08 (GMT) |
commit | 110b6fecbbb86143a4acb568f50eab2c870e7d34 (patch) | |
tree | ccc11fe14604c7c08bb750b392f67559a3cfd962 /Objects/unicodeobject.c | |
parent | 186122ead26f3ae4c2bc9f6715d2a29d339fdc5a (diff) | |
download | cpython-110b6fecbbb86143a4acb568f50eab2c870e7d34.zip cpython-110b6fecbbb86143a4acb568f50eab2c870e7d34.tar.gz cpython-110b6fecbbb86143a4acb568f50eab2c870e7d34.tar.bz2 |
#27364: Deprecate invalid escape strings in str/byutes.
Patch by Emanuel Barry, reviewed by Serhiy Storchaka and Martin Panter.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 7979eec..e0c3bfe 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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; |