cpython/Objects
Guido van Rossum 2ffbf6b112 Deal properly (?) with comparing recursive datastructures.
- Use the compare nesting level and in-progress dictionary properly in
  PyObject_RichCompare().

- Change the in-progress code to use static variables instead of
  globals (both the nesting level and the key for the thread dict were
  globals but have no reason to be globals; the key can even be a
  function-static variable in get_inprogress_dict()).

- Rewrote try_rich_to_3way_compare() to benefit from the similarity of
  the three cases, making it table-driven.

- In try_rich_to_3way_compare(), test for EQ before LT and GT.  This
  turns out essential when comparing recursive UserList instances;
  with the old code, these would recurse into rich comparison three
  times for each nesting level up to NESTING_LIMIT/2, making the total
  number of calls in the order of 3**(NESTING_LIMIT/2)!

NOTE: I'm not 100% comfortable with this.  It works for the standard
test suite (which compares a few trivial recursive data structures
only), but I'm not sure that the in-progress dictionary is used
properly by the rich comparison code.  Jeremy suggested that maybe the
operation should be included in the dict.  Currently I presume that
objects in the dict are equal unless proven otherwise, and I set the
outcome for the rich comparison accordingly: true for operators EQ,
LE, GE, and false for the other three.  But Jeremy seems to think that
there may be counter-examples where this doesn't do the right thing.
2001-01-17 21:27:02 +00:00
..
.cvsignore Ignore a bunch of generated files. 2000-05-02 18:34:30 +00:00
Makefile.in Update dependencies per /F. 2000-11-28 12:09:18 +00:00
abstract.c Rich comparisons fall-out: 2001-01-17 15:29:42 +00:00
bufferobject.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
classobject.c Rich comparisons. 2001-01-17 15:28:20 +00:00
cobject.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
complexobject.c Rationalize use of limits.h, moving the inclusion to Python.h. 2000-09-26 05:46:01 +00:00
dictobject.c dict_update has two boundary conditions: a.update(a) and a.update({}) 2001-01-03 22:34:59 +00:00
fileobject.c Rationalizing the fallback code for portable fseek -- this is all much 2001-01-16 20:53:31 +00:00
floatobject.c Rich comparisons fall-out: 2001-01-17 15:33:42 +00:00
frameobject.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
funcobject.c Committing PEP 232, function attribute feature, approved by Guido. 2001-01-15 20:40:19 +00:00
intobject.c Rich comparisons fall-out: 2001-01-17 15:32:23 +00:00
listobject.c fix leak 2001-01-03 22:32:16 +00:00
longobject.c Rich comparisons fall-out: 2001-01-17 15:33:18 +00:00
methodobject.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
moduleobject.c Add garbage collection for module objects. Closes patch #102939 and 2001-01-02 15:58:27 +00:00
object.c Deal properly (?) with comparing recursive datastructures. 2001-01-17 21:27:02 +00:00
rangeobject.c SF patch #103158 by Greg Ball: Don't do unsafe arithmetic in xrange 2001-01-15 18:58:56 +00:00
sliceobject.c Test for NULL returned from PyObject_NEW(). 2000-12-14 15:09:46 +00:00
stringobject.c Added checks to prevent PyUnicode_Count() from dumping core 2001-01-16 11:54:12 +00:00
tupleobject.c Simplify _PyTuple_Resize by not using the tuple free list and dropping 2000-10-05 19:36:49 +00:00
typeobject.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
unicodectype.c unicode database compression, step 3: 2000-09-25 21:48:13 +00:00
unicodeobject.c This patch adds a new builtin unistr() which behaves like str() 2001-01-17 17:09:53 +00:00
unicodetype_db.h Added 38,642 missing characters to the Unicode database (first-last 2000-11-03 20:24:15 +00:00
xxobject.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00