Skip to content

Commit 3f36149

Browse files
committed
fix(pathfinder): satisfy canary probe pre-commit hooks
Mark the intentional subprocess launches as trusted inputs for Ruff's bandit checks and keep the affected files in hook-compliant import/format order. Made-with: Cursor
1 parent 35afc11 commit 3f36149

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/canary_probe_subprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44

5+
import json
56
import sys
67
from collections.abc import Sequence
7-
import json
88

99
from cuda.pathfinder._dynamic_libs.lib_descriptor import LIB_DESCRIPTORS
1010
from cuda.pathfinder._dynamic_libs.load_dl_common import DynamicLibNotFoundError, LoadedDL

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_nvidia_dynamic_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _raise_canary_probe_child_process_error(
9696
def _resolve_system_loaded_abs_path_in_subprocess(libname: str) -> str | None:
9797
"""Resolve a canary library's absolute path in a fresh Python subprocess."""
9898
try:
99-
result = subprocess.run(
99+
result = subprocess.run( # noqa: S603 - trusted argv: current interpreter + internal probe module
100100
[sys.executable, "-m", _CANARY_PROBE_MODULE, libname],
101101
capture_output=True,
102102
text=True,

cuda_pathfinder/tests/test_ctk_root_discovery.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,10 @@ def test_subprocess_probe_does_not_reenter_calling_script(tmp_path):
289289
env = os.environ.copy()
290290
existing_pythonpath = env.get("PYTHONPATH")
291291
env["PYTHONPATH"] = (
292-
str(_PACKAGE_ROOT)
293-
if not existing_pythonpath
294-
else os.pathsep.join((str(_PACKAGE_ROOT), existing_pythonpath))
292+
str(_PACKAGE_ROOT) if not existing_pythonpath else os.pathsep.join((str(_PACKAGE_ROOT), existing_pythonpath))
295293
)
296294

297-
result = subprocess.run(
295+
result = subprocess.run( # noqa: S603 - trusted argv: current interpreter + temp script created by this test
298296
[sys.executable, str(script_path)],
299297
capture_output=True,
300298
text=True,

0 commit comments

Comments
 (0)