You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
geotiff: make _FileSource a context manager (cleanup follow-up to #2444) #2449
xrspatial.geotiff._sources._FileSource exposes close() but no __enter__ / __exit__. Every call site has to wrap it in try / finally to guarantee mmap release. PR #2448 added another such call site in _vrt_validation._check_mixed_source_crs, and a code-review nit flagged the resulting try / except / finally / continue shape as harder to scan than a with block.
Proposal
Add __enter__ / __exit__ to _FileSource so callers can write:
Then sweep the existing call sites (search for _FileSource( in xrspatial/geotiff/) and replace each try / finally with a with block. The mmap-cache release semantics stay the same; the helper change is mechanical.
Drawbacks
Mechanical sweep across several files. Worth verifying that no call site relies on the handle outliving a function scope before swapping wholesale.
Additional Notes or Context
Surfaced during review of PR #2448. Not blocking that PR; tracked here so the cleanup is not forgotten.
Activity
Address review nits: tidy __exit__ and test helpers (#2449)
geotiff: make _FileSource a context manager (#2449) (#2479)
Fix CI: gate slow corpus fixtures in dask backends + fold #2449 test (#…
geotiff tests: consolidate closing cluster 16 — features / golden-cor…