remove finally

This commit is contained in:
Will McGugan 2021-08-03 21:40:56 +01:00
parent af0327d182
commit dbeb776c90
1 changed files with 19 additions and 14 deletions

View File

@ -505,12 +505,17 @@ class Segment(NamedTuple):
pos = end_pos pos = end_pos
break break
try:
if end_pos == cut: if end_pos == cut:
add_segment(segment) add_segment(segment)
yield split_segments[:] yield split_segments[:]
del split_segments[:] del split_segments[:]
pos = end_pos pos = end_pos
try:
cut = next(iter_cuts)
except StopIteration:
if split_segments:
yield split_segments[:]
return
break break
else: else:
before, segment = segment.split_cells(cut - pos) before, segment = segment.split_cells(cut - pos)
@ -518,7 +523,7 @@ class Segment(NamedTuple):
yield split_segments[:] yield split_segments[:]
del split_segments[:] del split_segments[:]
pos = cut pos = cut
finally:
try: try:
cut = next(iter_cuts) cut = next(iter_cuts)
except StopIteration: except StopIteration: