summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bytesobject.c3
-rw-r--r--Objects/unicodeobject.c3
2 files changed, 5 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. */
}
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;