summaryrefslogtreecommitdiffstats
path: root/Objects/bytesobject.c
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2016-09-08 19:34:08 (GMT)
committerR David Murray <rdmurray@bitdance.com>2016-09-08 19:34:08 (GMT)
commit110b6fecbbb86143a4acb568f50eab2c870e7d34 (patch)
treeccc11fe14604c7c08bb750b392f67559a3cfd962 /Objects/bytesobject.c
parent186122ead26f3ae4c2bc9f6715d2a29d339fdc5a (diff)
downloadcpython-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/bytesobject.c')
-rw-r--r--Objects/bytesobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index b0d9b39..6e7c4fa 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -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. */
}