coreweave / tensorizer

Module, Model, and Tensor Serialization/Deserialization
MIT License
180 stars 25 forks source link

Ensure that data is decrypted in the event of an exception #163

Closed bchess closed 3 months ago

bchess commented 3 months ago

Closes #144

I think this was in better shape than initially expected, because _maybe_decrypt_data() did its work in a finally: block. Anyway, added two test cases. One that covers the event of a pwrite() raising an exception, and the other of an exception occurring in the main write block before _maybe_decrypt_data() is executed. The latter test was failing, and changes to the exception handler have been made to pass.