From: Walter Dörwald Date: Fri, 11 May 2007 17:25:52 +0000 (+0000) Subject: Simplify PyObject_Unicode(NULL) by using X-Git-Tag: v3.0a1~962 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b03ccc047278728d6d7173759bdbe83f22ecd9bc;p=thirdparty%2FPython%2Fcpython.git Simplify PyObject_Unicode(NULL) by using PyUnicode_FromString(). --- diff --git a/Objects/object.c b/Objects/object.c index 8597d888fb75..4b210f10b578 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -435,14 +435,9 @@ PyObject_Unicode(PyObject *v) PyObject *str; static PyObject *unicodestr; - if (v == NULL) { - res = PyString_FromString(""); - if (res == NULL) - return NULL; - str = PyUnicode_FromEncodedObject(res, NULL, "strict"); - Py_DECREF(res); - return str; - } else if (PyUnicode_CheckExact(v)) { + if (v == NULL) + return PyUnicode_FromString(""); + else if (PyUnicode_CheckExact(v)) { Py_INCREF(v); return v; }