This commit is contained in:
Kovid Goyal 2015-05-03 09:38:44 +05:30
parent e958df9028
commit b2eac6f919

View File

@ -296,7 +296,9 @@ class Blocks(object):
self.pos = len(self.all_blocks) self.pos = len(self.all_blocks)
self.block_map = {} self.block_map = {}
def __exit__(self, *args): def __exit__(self, etype, value, traceback):
if value is not None:
return # Since there was an exception, the data structures are not in a consistent state
if self.current_block is not None: if self.current_block is not None:
self.all_blocks.append(self.current_block) self.all_blocks.append(self.current_block)
self.current_block = None self.current_block = None