Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16135/Lib/test Modified Files: test_mutants.py Log Message: This test relied on short-circuiting details of dictobject.py to avoid crashing, and indirectly on the fact that hash codes in random.randrange(1000000000) were very unlikely to exhibit collisions. To see the problem, replace this number with 500 and observe the crash on either del target[key] or del keys[i]. The fix prevents recursive mutation, just as in the key insertion case. Index: test_mutants.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mutants.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- test_mutants.py 23 Jul 2002 19:03:57 -0000 1.7 +++ test_mutants.py 15 May 2005 13:29:26 -0000 1.8 @@ -69,14 +69,12 @@ elif keys: # Delete a key at random. + mutate = 0 # disable mutation until key deleted i = random.randrange(len(keys)) key = keys[i] del target[key] - # CAUTION: don't use keys.remove(key) here. Or do <wink>. The - # point is that .remove() would trigger more comparisons, and so - # also more calls to this routine. We're mutating often enough - # without that. del keys[i] + mutate = 1 # A horrid class that triggers random mutations of dict1 and dict2 when # instances are compared.