diff options
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 82867e0..8e2720b 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -155,20 +155,7 @@ builtin_unicode(self, args) if ( !PyArg_ParseTuple(args, "O|ss:unicode", &v, &encoding, &errors) ) return NULL; - /* Special case: Unicode will stay Unicode */ - if (PyUnicode_Check(v)) { - if (encoding) { - PyErr_SetString(PyExc_TypeError, - "unicode() does not support decoding of Unicode objects"); - return NULL; - } - Py_INCREF(v); - return v; - } - /* Read raw data and decode it */ - if (PyObject_AsReadBuffer(v, &buffer, &len)) - return NULL; - return PyUnicode_Decode((const char *)buffer, len, encoding, errors); + return PyUnicode_FromEncodedObject(v, encoding, errors); } static char unicode_doc[] = |