From 9e763c37407aec51b4b7511fe426029f9230c235 Mon Sep 17 00:00:00 2001 From: "sofia(fia)" Date: Sat, 21 Nov 2026 09:42:22 -0300 Subject: [PATCH] gh-155031: repass permission errors on subprocesses to parent / user (GH-155032) (cherry picked from commit 1822ff517a9030ea2a36b9512b13f2f0973df527) Co-authored-by: sofia(fia) --- Lib/profiling/sampling/__main__.py | 2 +- Lib/profiling/sampling/_child_monitor.py | 1 - .../next/Library/2026-08-01-10-54-39.gh-issue-155031.sTB_n8.rst | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2026-08-01-10-54-39.gh-issue-155031.sTB_n8.rst diff --git a/Lib/profiling/sampling/__main__.py b/Lib/profiling/sampling/__main__.py index a45b645eae05fc..c0e022ca4d0fa7 100644 --- a/Lib/profiling/sampling/__main__.py +++ b/Lib/profiling/sampling/__main__.py @@ -58,13 +58,13 @@ def handle_permission_error(): print(WINDOWS_PERMISSION_ERROR, file=sys.stderr) else: print(GENERIC_PERMISSION_ERROR, file=sys.stderr) - sys.exit(1) if __name__ == '__main__': try: main() except PermissionError: handle_permission_error() + sys.exit(1) except SamplingUnknownProcessError as err: print(f"Tachyon cannot find the process: {err}", file=sys.stderr) sys.exit(1) diff --git a/Lib/profiling/sampling/_child_monitor.py b/Lib/profiling/sampling/_child_monitor.py index ec56f75719f9d1..7c73ec26d88a33 100644 --- a/Lib/profiling/sampling/_child_monitor.py +++ b/Lib/profiling/sampling/_child_monitor.py @@ -237,7 +237,6 @@ def _spawn_profiler_for_child(self, child_pid): cmd, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, ) with self._lock: if self._stop_event.is_set(): diff --git a/Misc/NEWS.d/next/Library/2026-08-01-10-54-39.gh-issue-155031.sTB_n8.rst b/Misc/NEWS.d/next/Library/2026-08-01-10-54-39.gh-issue-155031.sTB_n8.rst new file mode 100644 index 00000000000000..954e4cc2e54ac0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-08-01-10-54-39.gh-issue-155031.sTB_n8.rst @@ -0,0 +1,2 @@ +Propagate to user any permission errors from subprocess attach commands in +Tachyon