Commit 28962cc0 authored by Guido van Rossum's avatar Guido van Rossum

Given a class without __cmp__ or __eq__, cmp() of two instances of

that class should compare the id() of those instances.  Add a test
that verifies this.  This test currently fails; I believe this is
caused by object.c:2.132 (Patch #424475 by loewis).
parent ce1650f3
......@@ -44,5 +44,13 @@ def test():
print "%s == %s" % (a, b)
else:
print "%s != %s" % (a, b)
# Ensure default comparison compares id() of args
L = [None]
for i in range(10):
L.insert(len(L)/2, Empty())
for a in L:
for b in L:
if cmp(a, b) != cmp(id(a), id(b)):
print "ERROR:", cmp(a, b), cmp(id(a), id(b)), id(a), id(b)
test()
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