Remove temporary model files after failed writes

This commit is contained in:
Andras Schmelczer 2026-10-27 16:53:49 +00:00
commit f629b16cd2

View file

@ -146,11 +146,13 @@ class LargeFileBase(ABC):
) -> Literal[False]:
self._file.close()
if type is None:
if "w" in self._mode:
self.push(Path(self._file.name))
if "w" in self._mode:
try:
if type is None:
self.push(Path(self._file.name))
finally:
os.unlink(self._file.name)
else:
elif type is not None:
logger.exception("Could not finish operation.")
return False