[issue21253] Difflib.compare() crashes on mostly different sequences

2014-04-18 Thread Tim Peters
Tim Peters added the comment: Comparison can certainly trigger a recursion error if the sequences contain no (or few) matching non-junk elements, but contain many "almost matching" elements. If the sequences have lengths M and N, recursion can go as deep as 2*min(M, N) then. Now in the test

[issue21253] Difflib.compare() crashes on mostly different sequences

2014-04-18 Thread Gregory P. Smith
Gregory P. Smith added the comment: It appears to devolve into linear recursion in this case, one per each item in one of the sequences being searched for a match, so even using a stack seems wrong as it'd still be linear (though it would prevent the recursion depth problem). The mutual _fanc

[issue21253] Difflib.compare() crashes on mostly different sequences

2014-04-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: An obvious fix for the recursion limit error is to convert the .compare recursion to iteration with a stack (which I could try to do), but I don't know if the deep recursion is expected in this case, or is a bug. Tim? -- nosy: +terry.reedy, tim.peters