]> granicus.if.org Git - python/commitdiff
Fix refcounting bug reported by Amaury Forgeot d'Arc.
authorGuido van Rossum <guido@python.org>
Thu, 29 Mar 2007 20:49:57 +0000 (20:49 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 29 Mar 2007 20:49:57 +0000 (20:49 +0000)
Objects/typeobject.c

index be6f279466f85e6c4e281b6f2fc5fde9fe896c69..1ccd97b7b2903489f44908857b141eab57f4f00d 100644 (file)
@@ -2311,6 +2311,7 @@ object_richcompare(PyObject *self, PyObject *other, int op)
 
        case Py_EQ:
                res = (self == other) ? Py_True : Py_False;
+               Py_INCREF(res);
                break;
 
        case Py_NE:
@@ -2334,10 +2335,10 @@ object_richcompare(PyObject *self, PyObject *other, int op)
 
        default:
                res = Py_NotImplemented;
+               Py_INCREF(res);
                break;
        }
 
-       Py_INCREF(res);
        return res;
 }