In PyKeepass we wrap build_file with a write to a temporary file followed by a file move to prevent the database from being corrupted during building if there's an exception
I imagine this is a fairly common design idiom (any build-time exception is guaranteed to corrupt if overwriting original data), so I was wondering if this might be worth making it built-in, or if you think it is out of scope.
There are performance tradeoffs of course (requires storing to another file/buffer before moving/copying), so it would need to be behind a flag safe=True or something.
In PyKeepass we wrap
build_filewith a write to a temporary file followed by a file move to prevent the database from being corrupted during building if there's an exceptionI imagine this is a fairly common design idiom (any build-time exception is guaranteed to corrupt if overwriting original data), so I was wondering if this might be worth making it built-in, or if you think it is out of scope.
There are performance tradeoffs of course (requires storing to another file/buffer before moving/copying), so it would need to be behind a flag
safe=Trueor something.