From 110b6fecbbb86143a4acb568f50eab2c870e7d34 Mon Sep 17 00:00:00 2001 From: R David Murray Date: Thu, 8 Sep 2016 15:34:08 -0400 Subject: #27364: Deprecate invalid escape strings in str/byutes. Patch by Emanuel Barry, reviewed by Serhiy Storchaka and Martin Panter. --- Objects/bytesobject.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Objects/bytesobject.c') diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index b0d9b39825..6e7c4fa188 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. */ } -- cgit v1.2.1