Issue 21635: Fix caching in difflib.SequenceMatcher.get_matching_blocks().

This commit is contained in:
Raymond Hettinger 2014-06-21 11:57:36 -07:00
parent 8aa9e4268f
commit fabefc3c5b
3 changed files with 15 additions and 2 deletions

View file

@ -511,8 +511,8 @@ class SequenceMatcher:
non_adjacent.append((i1, j1, k1))
non_adjacent.append( (la, lb, 0) )
self.matching_blocks = non_adjacent
return map(Match._make, self.matching_blocks)
self.matching_blocks = list(map(Match._make, non_adjacent))
return self.matching_blocks
def get_opcodes(self):
"""Return list of 5-tuples describing how to turn a into b.