move savefile flush into try: block
it seems flush might throw which will not be caught inside the (try-) else branch. (hopefully) fixes config corruption when no space available.
This commit is contained in:
parent
72e5bf35e1
commit
69ce9a942c
@ -207,12 +207,11 @@ def savefile_open(filename, binary=False, encoding='utf-8'):
|
||||
else:
|
||||
new_f = io.TextIOWrapper(PyQIODevice(f), encoding=encoding)
|
||||
yield new_f
|
||||
new_f.flush()
|
||||
except:
|
||||
f.cancelWriting()
|
||||
cancelled = True
|
||||
raise
|
||||
else:
|
||||
new_f.flush()
|
||||
finally:
|
||||
commit_ok = f.commit()
|
||||
if not commit_ok and not cancelled:
|
||||
|
Loading…
Reference in New Issue
Block a user