Issue 979794: diffutil errors when comparing 2 0 byte entries (original) (raw)

difflib has a problem where if the two things that it is comparing are 0 byte/null that when it comes time to output the results, it errors because a generator appears to not be properly set up.

To duplicate easily, use the diff.py utility in Tools/scripts and diff two zero byte files.

This error does not occur if either of the objects being compared has content.

File "diff.py", line 40, in ? sys.stdout.writelines(diff) File "/usr/local/lib/python2.3/difflib.py", line 1215, in context_diff for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n): File "/usr/local/lib/python2.3/difflib.py", line 574, in get_grouped_opcodes if codes[0][0] == 'equal': IndexError: list index out of range