Issue 825639: let's get rid of cyclic object comparison (original) (raw)

Created on 2003-10-17 17:49 by arigo, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
no_graph_compare.diff arigo,2003-10-17 17:49 a diff with a lot of '-'
no_graph_compare2.diff arigo,2003-10-26 18:19 Second patch
Messages (5)
msg44793 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2003-10-17 17:49
Comparison of objects with recursive references is a cool feature but it leaves too many questions open and feels too much like a "do-what-i-mean" hack. Attached patch casts it into the obscure world of CVS history. On the positive side, the patch contributes a Py_EnterRecursiveCall()/Py_LeaveRecursiveCall() pair of functions to the C API, to use at any point where an infinite C-level recursion could occur. This is now used by: eval_frame() PyObject_Compare() PyObject_RichCompare() instance_call() and maybe it should be extended to cPickle.c, which has its own notion of maximum nesting as well. The diff also changes the tests to expect a RuntimeError when comparing nested structures.
msg44794 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-10-19 18:41
Logged In: YES user_id=21627 I think the patch needs to be discussed on python-dev to get a chance to be accepted. It should also be accompanied with a more elaborate rationale, and a guideline on how applications that rely on the feature could detect the change, and how those applications need to be updated. For example, I find the change to the pickle tester unacceptable: you can't just drop the structural-equivalence test, since it is the primary purpose of this test to establish structural equivalence. So perhaps you should put a custom structural-equivalence algorithm into pickletester, and replace the assertEquals with that.
msg44795 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2003-10-23 11:13
Logged In: YES user_id=4771 Ok. Before I reply to python-dev let me point out that I tried not to weaken any test. I guess you thought I just removed some tests, because I indeed usually replaced a group of self.assertXxx() lines with a smaller number of assertions, but as far as I can tell they all test the structure as much as the original assertions, and sometimes even more.
msg44796 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2003-10-26 18:19
Logged In: YES user_id=4771 Another version of the patch. This one is quite faster -- I'm measuring the performance of: a = [5] * 1000 b = [a] * 1000 b == b for which test is appears now to have no measurable penalty. The drawback of this patch is a few extra obscure macros in ceval.h. Read the new comment in ceval.c for the idea.
msg44797 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2003-10-28 12:08
Logged In: YES user_id=4771 For full details: http://mail.python.org/pipermail/python-dev/2003-October/039445.html Checked in: Misc/NEWS (rev: 1.879) Include/ceval.h (rev: 2.50) Python/ceval.c (rev: 2.371) Objects/classobject.c (rev: 2.173) Objects/object.c (rev: 2.211) Lib/test/pickletester.py (rev: 1.56) Lib/test/test_builtin.py (rev: 1.24) Lib/test/test_copy.py (rev: 1.12) Lib/test/test_richcmp.py (rev: 1.10)
History
Date User Action Args
2022-04-10 16:11:46 admin set github: 39424
2003-10-17 17:49:35 arigo create