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