]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix SF Bug 572567: Memory leak in object comparison
authorRaymond Hettinger <python@rcn.com>
Mon, 24 Jun 2002 13:25:41 +0000 (13:25 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 24 Jun 2002 13:25:41 +0000 (13:25 +0000)
Lib/test/test_descr.py
Misc/ACKS
Objects/typeobject.c

index a526ad4769ff9aeb4aba31ed5b228f6fe6b672ee..2b38ecc4fa8b5f5193ff8745e1333269bb4c4a93 100644 (file)
@@ -1105,6 +1105,18 @@ def slots():
     gc.collect()
     vereq(Counted.counter, 0)
 
+    # Test lookup leaks [SF bug 572567]
+    import sys,gc
+    class G(object):
+        def __cmp__(self, other):
+            return 0
+    g = G()
+    orig_objects = len(gc.get_objects())
+    for i in xrange(10):
+        g==g
+    new_objects = len(gc.get_objects())
+    vereq(orig_objects, new_objects)
+
 def dynamics():
     if verbose: print "Testing class attribute propagation..."
     class D(object):
index c9d8cc93692a48ca6c1247a421d7770c3fc73aa7..a35b72387114bb6d1ba0ee8d9648ac5329ce4a6d 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -219,6 +219,7 @@ John Interrante
 Ben Jackson
 Paul Jackson
 David Jacobs
+Kevin Jacobs
 Jack Jansen
 Bill Janssen
 Drew Jenkins
index 09e4aa7e945cf9f3497ff5b4f09b2347c1b664bb..1a99a1eb825d755ae33915b06037d3e0fd53d44f 100644 (file)
@@ -3177,6 +3177,7 @@ half_compare(PyObject *self, PyObject *other)
                        res = PyObject_Call(func, args, NULL);
                        Py_DECREF(args);
                }
+               Py_DECREF(func);
                if (res != Py_NotImplemented) {
                        if (res == NULL)
                                return -2;