Index: Objects/stringobject.c =================================================================== --- Objects/stringobject.c (revision 58376) +++ Objects/stringobject.c (working copy) @@ -772,7 +772,7 @@ Py_ssize_t length = PyString_GET_SIZE(op); size_t newsize = 3 + 4 * Py_Size(op); PyObject *v; - if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_Size(op)) { + if (newsize > PY_SSIZE_T_MAX || (newsize-3) / 4 != Py_Size(op)) { PyErr_SetString(PyExc_OverflowError, "string is too large to make repr"); } @@ -803,7 +803,7 @@ ; } - *p++ = 's', *p++ = quote; + *p++ = 'b', *p++ = quote; for (i = 0; i < Py_Size(op); i++) { /* There's at least enough room for a hex escape and a closing quote. */ @@ -875,7 +875,7 @@ if (PyBytes_Check(bb)) return PyBytes_Concat((PyObject *)a, bb); PyErr_Format(PyExc_TypeError, - "cannot concatenate 'str8' and '%.200s' objects", + "cannot concatenate 'bytes' and '%.200s' objects", Py_Type(bb)->tp_name); return NULL; } @@ -3091,7 +3091,7 @@ goto onError; if (!PyBytes_Check(v)) { PyErr_Format(PyExc_TypeError, - "[str8] encoder did not return a bytes object " + "[bytes] encoder did not return a bytes object " "(type=%.400s)", Py_Type(v)->tp_name); Py_DECREF(v); @@ -3754,7 +3754,7 @@ if (type != &PyString_Type) return str_subtype_new(type, args, kwds); - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:str8", kwlist, &x)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:bytes", kwlist, &x)) return NULL; if (x == NULL) return PyString_FromString("");