Commit ab5dae35 authored by Raymond Hettinger's avatar Raymond Hettinger

Fix SF bug 572567: Memory leak in object comparison.

parent 563d12d1
......@@ -1163,6 +1163,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):
......
......@@ -233,6 +233,7 @@ John Interrante
Ben Jackson
Paul Jackson
David Jacobs
Kevin Jacobs
Geert Jansen
Jack Jansen
Bill Janssen
......
......@@ -3286,6 +3286,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment