]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Simplify PyObject_Unicode(NULL) by using
authorWalter Dörwald <walter@livinglogic.de>
Fri, 11 May 2007 17:25:52 +0000 (17:25 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Fri, 11 May 2007 17:25:52 +0000 (17:25 +0000)
PyUnicode_FromString().

Objects/object.c

index 8597d888fb75003bfceaf4c746034e06da41e495..4b210f10b578e734dce6400b7eac9eace6828d59 100644 (file)
@@ -435,14 +435,9 @@ PyObject_Unicode(PyObject *v)
        PyObject *str;
        static PyObject *unicodestr;
 
-       if (v == NULL) {
-               res = PyString_FromString("<NULL>");
-               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("<NULL>");
+       else if (PyUnicode_CheckExact(v)) {
                Py_INCREF(v);
                return v;
        }