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:
|
else:
|
||||||
new_f = io.TextIOWrapper(PyQIODevice(f), encoding=encoding)
|
new_f = io.TextIOWrapper(PyQIODevice(f), encoding=encoding)
|
||||||
yield new_f
|
yield new_f
|
||||||
|
new_f.flush()
|
||||||
except:
|
except:
|
||||||
f.cancelWriting()
|
f.cancelWriting()
|
||||||
cancelled = True
|
cancelled = True
|
||||||
raise
|
raise
|
||||||
else:
|
|
||||||
new_f.flush()
|
|
||||||
finally:
|
finally:
|
||||||
commit_ok = f.commit()
|
commit_ok = f.commit()
|
||||||
if not commit_ok and not cancelled:
|
if not commit_ok and not cancelled:
|
||||||
|
Loading…
Reference in New Issue
Block a user