From b03ccc047278728d6d7173759bdbe83f22ecd9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20D=C3=B6rwald?= Date: Fri, 11 May 2007 17:25:52 +0000 Subject: Simplify PyObject_Unicode(NULL) by using PyUnicode_FromString(). --- Objects/object.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Objects/object.c b/Objects/object.c index 8597d88..4b210f1 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; } -- cgit v0.12