]> granicus.if.org Git - python/commitdiff
Fix bug found by Coverity: don't allow NULL argument to PyUnicode_CheckExact
authorGeorg Brandl <georg@python.org>
Mon, 13 Mar 2006 22:22:11 +0000 (22:22 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 13 Mar 2006 22:22:11 +0000 (22:22 +0000)
Objects/object.c

index 866ce068c2091db5c4208dbe6464ca45a78ea8fc..c4634f7d074dc48c44347c7e9df086c4e01e95d6 100644 (file)
@@ -402,9 +402,9 @@ PyObject_Unicode(PyObject *v)
        PyObject *func;
        static PyObject *unicodestr;
 
-       if (v == NULL)
+       if (v == NULL) {
                res = PyString_FromString("<NULL>");
-       if (PyUnicode_CheckExact(v)) {
+       } else if (PyUnicode_CheckExact(v)) {
                Py_INCREF(v);
                return v;
        }