From 3b1c918e2e389be9847ae61339bf45182c2140b5 Mon Sep 17 00:00:00 2001 From: Anna Petrasova Date: Tue, 16 Jun 2026 17:13:20 -0400 Subject: [PATCH] grass.script: Sanitize GRASS_MASK in mapset environment --- python/grass/script/core.py | 2 ++ python/grass/script/tests/grass_script_setup_test.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/grass/script/core.py b/python/grass/script/core.py index 389e7c2dd5b..a36b2fa7cc5 100644 --- a/python/grass/script/core.py +++ b/python/grass/script/core.py @@ -2246,6 +2246,8 @@ def sanitize_mapset_environment(env): del env["WIND_OVERRIDE"] if "GRASS_REGION" in env: del env["GRASS_REGION"] + if "GRASS_MASK" in env: + del env["GRASS_MASK"] return env diff --git a/python/grass/script/tests/grass_script_setup_test.py b/python/grass/script/tests/grass_script_setup_test.py index 88b0ca309ed..454ee04d736 100644 --- a/python/grass/script/tests/grass_script_setup_test.py +++ b/python/grass/script/tests/grass_script_setup_test.py @@ -469,7 +469,7 @@ def test_grass_path_types_in_setup(tmp_path, path_type): assert "GISBASE" in env -@pytest.mark.parametrize("variable", ["GRASS_REGION", "WIND_OVERRIDE"]) +@pytest.mark.parametrize("variable", ["GRASS_REGION", "WIND_OVERRIDE", "GRASS_MASK"]) @pytest.mark.usefixtures("mock_no_session") def test_init_removes_mapset_variables(tmp_path, variable): """Check that init removes mapset-specific variables from the environment.