restore finally

This commit is contained in:
Will McGugan 2021-08-05 16:33:25 +01:00
parent dbeb776c90
commit 16bf5cba8b
1 changed files with 14 additions and 19 deletions

View File

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