summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-10-20 17:08:15 +0300
committerGitHub <noreply@github.com>2017-10-20 17:08:15 +0300
commit56cb465cc93dcb35aaf7266ca3dbe2dcff1fac5f (patch)
treeb9bce18e156f23827247be42659d6fe99cd5c1cd /Objects
parent525f40d231aba2c004619fc7a5207171ed65b0cb (diff)
downloadcpython-git-56cb465cc93dcb35aaf7266ca3dbe2dcff1fac5f.tar.gz
bpo-31825: Fixed OverflowError in the 'unicode-escape' codec (#4058)
and in codecs.escape_decode() when decode an escaped non-ascii byte.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bytesobject.c2
-rw-r--r--Objects/unicodeobject.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 6a4eb67808..48b6501f7a 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -1257,7 +1257,7 @@ PyObject *PyBytes_DecodeEscape(const char *s,
if (first_invalid_escape != NULL) {
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
"invalid escape sequence '\\%c'",
- *first_invalid_escape) < 0) {
+ (unsigned char)*first_invalid_escape) < 0) {
Py_DECREF(result);
return NULL;
}
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index bb1c0830fc..2f308774d7 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -6136,7 +6136,7 @@ PyUnicode_DecodeUnicodeEscape(const char *s,
if (first_invalid_escape != NULL) {
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
"invalid escape sequence '\\%c'",
- *first_invalid_escape) < 0) {
+ (unsigned char)*first_invalid_escape) < 0) {
Py_DECREF(result);
return NULL;
}