Index: Modules/_json.c =================================================================== --- Modules/_json.c (revision 86121) +++ Modules/_json.c (working copy) @@ -440,7 +440,6 @@ Py_ssize_t len = PyString_GET_SIZE(pystr); Py_ssize_t begin = end - 1; Py_ssize_t next; - int has_unicode = 0; char *buf = PyString_AS_STRING(pystr); PyObject *chunks = PyList_New(0); if (chunks == NULL) { @@ -463,9 +462,6 @@ raise_errmsg("Invalid control character at", pystr, next); goto bail; } - else if (c > 0x7f) { - has_unicode = 1; - } } if (!(c == '"' || c == '\\')) { raise_errmsg("Unterminated string starting at", pystr, begin); @@ -477,16 +473,11 @@ if (strchunk == NULL) { goto bail; } - if (has_unicode) { - chunk = PyUnicode_FromEncodedObject(strchunk, encoding, NULL); - Py_DECREF(strchunk); - if (chunk == NULL) { - goto bail; - } + chunk = PyUnicode_FromEncodedObject(strchunk, encoding, NULL); + Py_DECREF(strchunk); + if (chunk == NULL) { + goto bail; } - else { - chunk = strchunk; - } if (PyList_Append(chunks, chunk)) { Py_DECREF(chunk); goto bail; @@ -593,22 +584,10 @@ } #endif } - if (c > 0x7f) { - has_unicode = 1; + chunk = PyUnicode_FromUnicode(&c, 1); + if (chunk == NULL) { + goto bail; } - if (has_unicode) { - chunk = PyUnicode_FromUnicode(&c, 1); - if (chunk == NULL) { - goto bail; - } - } - else { - char c_char = Py_CHARMASK(c); - chunk = PyString_FromStringAndSize(&c_char, 1); - if (chunk == NULL) { - goto bail; - } - } if (PyList_Append(chunks, chunk)) { Py_DECREF(chunk); goto bail;