[Python-Dev] very slow compare of recursive objects

Tim Peters tim.one@comcast.net
Sun, 19 Jan 2003 20:09:14 -0500


Speaking of graceful approaches, I expect that this code:

		(v->ob_type->tp_as_mapping
		 || (v->ob_type->tp_as_sequence
		     && !PyString_Check(v)
		     && !PyTuple_Check(v)))) {

no longer does what it intended to do for tuples.  Tuples can't be
recursive, so it intended to exempt tuples from the recursive-compare
machinery.  But Michael Hudson added a non-NULL tp_as_mapping slot to tuples
in rev 2.65 of tupleobject.c, so tuples are no longer exempted by the
recursive-compare gimmick.  That makes the problem in 2.3 worse than it used
to be (although it's never been zippy, due to clearing inprogress dict
entries while they're still potentially useful).  So all the hacks I added
(in my ugly patch) to keep check_recursion's tuple operations out of this
code would be better done by restoring the "don't look at tuples at all"
intent of the code above.