[GRASS-git] [OSGeo/grass] 9c6279: grass.pygrass: Close RasterRow via context manager...
Edouard Choinière
noreply at github.com
Sun Sep 6 04:04:13 PDT 2026
Branch: refs/heads/main
Home: https://github.com/OSGeo/grass
Commit: 9c627939b6f2f561c43cedc5e5df7fb5a045483c
https://github.com/OSGeo/grass/commit/9c627939b6f2f561c43cedc5e5df7fb5a045483c
Author: Edouard Choinière <27212526+echoix at users.noreply.github.com>
Date: 2026-09-06 (Sun, 06 Sep 2026)
Changed paths:
M python/grass/pygrass/raster/testsuite/test_raster_region.py
Log Message:
-----------
grass.pygrass: Close RasterRow via context manager in region tests (#7902)
test_resampling_1 and test_resampling_2 called rast.close() as a bare
statement after their assertions, so a failing assertion (or any other
exception) would skip it, leaving the RasterRow open. This repo's own
Region.set_raster_region() documents the consequence: "All raster
objects must be closed or the process will be terminated." The next
test in this file, test_resampling_to_numpy, calls exactly that method
on every resampling step, so an open handle carried over from an
earlier test crashes it with an unrelated-looking C-level FERROR
instead of the real assertion failure ever being reported.
Use `with rast:` instead, matching RasterRow's documented context
manager support, so the raster is always closed, including when an
assertion fails.
Co-authored-by: Claude Sonnet 5 <noreply at anthropic.com>
To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications
More information about the grass-commit
mailing list