Only finally-write around the ledger yield up
parent
fbee33b00d
commit
3dcb72d429
|
@ -69,10 +69,10 @@ def open_trade_ledger(
|
|||
)
|
||||
with open(tradesfile, 'w') as cf:
|
||||
pass # touch
|
||||
try:
|
||||
with open(tradesfile, 'r') as cf:
|
||||
ledger = toml.load(tradesfile)
|
||||
cpy = ledger.copy()
|
||||
try:
|
||||
yield cpy
|
||||
finally:
|
||||
if cpy != ledger:
|
||||
|
|
Loading…
Reference in New Issue