diff Lib/difflib.py @ 32612:5546c7ae24f7 legacy-trunk

SequenceMatcher(None, [], []).get_grouped_opcodes() now returns a generator that behaves as if both lists has an empty string in each of them. Closes bug #979794 (and duplicate bug #980117).
author Brett Cannon <bcannon@gmail.com>
date Sat, 10 Jul 2004 23:54:07 +0000
parents a46bde9e0c74
children 8d25835f88ae
line wrap: on
line diff
--- a/Lib/difflib.py	Sat Jul 10 23:39:35 2004 +0000
+++ b/Lib/difflib.py	Sat Jul 10 23:54:07 2004 +0000
@@ -572,6 +572,8 @@
         """
 
         codes = self.get_opcodes()
+        if not codes:
+            codes = [("equal", 0, 1, 0, 1)]
         # Fixup leading and trailing groups if they show no changes.
         if codes[0][0] == 'equal':
             tag, i1, i2, j1, j2 = codes[0]