aai-institute / lakefs-spec

An fsspec implementation for the lakeFS project
http://lakefs-spec.org/
Apache License 2.0
39 stars 4 forks source link

Overload `LakeFSFile.__del__` to pass statement #219

Closed nicholasjng closed 9 months ago

nicholasjng commented 9 months ago

Previously, the file was closed again on deletion, which is bad practice if an exception occurred in write mode, since any exception on write will immediately reappear in the exit routine.

This has potential to disturb Python exit cleanup, so we just unset the closing attempt in __del__. Any users wanting to upload a file implicitly have to use a context manager (which is preferred, anyway), otherwise, they have to call file.close() themselves.

Fixes #218.

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (d49d01e) 90.01% compared to head (36c7a89) 90.05%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #219 +/- ## ========================================== + Coverage 90.01% 90.05% +0.03% ========================================== Files 7 7 Lines 531 533 +2 Branches 85 85 ========================================== + Hits 478 480 +2 Misses 27 27 Partials 26 26 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.