]> git.ipfire.org Git - thirdparty/Python/cpython.git/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:15 +0000 (22:22 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 13 Mar 2006 22:22:15 +0000 (22:22 +0000)
 (backport from rev. 43014)

Objects/object.c

index 3f70009bd3ff8101a0ee5859bfa776a77146e7d5..87aa475a60928b5204524fbdc53314cd78dace3f 100644 (file)
@@ -374,9 +374,9 @@ PyObject_Unicode(PyObject *v)
 {
        PyObject *res;
 
-       if (v == NULL)
+       if (v == NULL) {
                res = PyString_FromString("<NULL>");
-       if (PyUnicode_CheckExact(v)) {
+       } else if (PyUnicode_CheckExact(v)) {
                Py_INCREF(v);
                return v;
        }