From d2c5b4b549b24e637b16c60bdfae7292e1e75c06 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 10 Jul 2004 23:54:07 +0000 Subject: 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). --- Lib/difflib.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/difflib.py') diff --git a/Lib/difflib.py b/Lib/difflib.py index 529c78638c..e82c703a7d 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -572,6 +572,8 @@ class SequenceMatcher: """ 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] -- cgit v1.2.1