bug in sorting?

Fraser@europarc.xerox.com
Fri, 6 Aug 1993 11:04:24 PDT

The following little program causes my python to core dump with a bus
error. Could others try it and see if it does the same? As far as I
can see, the objects passed to the compare function are corrupted in
some way and the first operation on either one causes a crash. It
doesn't do it with 0.9.8. I've had a brief browse with my debugger but
without much luck.

Ta,
Quentin

--------------

#! /usr/local/bin/python

def compare(l1,l2):
if l1 < l2:
return -1
if l1 > l2:
return 1
return 0

names = ['joe', 'fred', 'peter']
names.sort(compare)

for i in names:
print i

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quentin Stafford-Fraser Tel: +44 223 341521
Rank Xerox EuroPARC, Fax: +44 223 341510
61 Regent Street, Home: +44 223 324451
Cambridge, CB2 1AB
United Kingdom Fraser@europarc.xerox.com