Skip to content

Commit

Permalink
Fix emitter close
Browse files Browse the repository at this point in the history
  • Loading branch information
sebaszm committed Nov 22, 2023
1 parent 3a36945 commit 91bf210
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions JsonGenerator/source/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ def __init__(self, file_name, indent_size, max_line_length = 160):

def __del__(self):
if self.file:
self.Flush()
self.file.close()
try:
self.Flush()
self.file.close()
except Exception:
import traceback
traceback.print_exc()
raise

def __enter__(self):
return self
Expand Down

0 comments on commit 91bf210

Please sign in to comment.