mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
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:
parent
b8e1717041
commit
d2c5b4b549
3 changed files with 13 additions and 0 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue