]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-148932: Improve error message if profiling.sampling run from venv on Windows platf...
authorSergey Miryanov <sergey.miryanov@gmail.com>
Sat, 2 May 2026 09:23:16 +0000 (14:23 +0500)
committerGitHub <noreply@github.com>
Sat, 2 May 2026 09:23:16 +0000 (09:23 +0000)
Lib/profiling/sampling/sample.py

index 6a76bbeeb24ee3f001775c4f81100f7e89430e55..9195f5ee6dd3902b1b44e1aedd5352bf3d201640 100644 (file)
@@ -58,6 +58,10 @@ class SampleProfiler:
         try:
             self.unwinder = self._new_unwinder(native, gc, opcodes, skip_non_matching_threads)
         except RuntimeError as err:
+            if os.name == "nt" and sys.executable.endswith("python.exe"):
+                raise SystemExit(
+                    "Running profiling.sampling from virtualenv on Windows platform is not supported"
+                ) from err
             raise SystemExit(err) from err
         # Track sample intervals and total sample count
         self.sample_intervals = deque(maxlen=100)