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).
This commit is contained in:
Brett Cannon 2004-07-10 23:54:07 +00:00
parent b8e1717041
commit d2c5b4b549
3 changed files with 13 additions and 0 deletions

View file

@ -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]