Skip to content

Commit ea11292

Browse files
committed
fixup! Move local imports to module level in sampling profiler
Keep curses import as a local import in sample_live() since curses is not available on Windows. The original code had this as a local import to avoid breaking Windows tests that import the module.
1 parent 0f57ae3 commit ea11292

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/profiling/sampling/sample.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import _remote_debugging
22
import contextlib
3-
import curses
43
import os
54
import statistics
65
import sys
@@ -460,6 +459,8 @@ def sample_live(
460459
Returns:
461460
The collector with collected samples
462461
"""
462+
import curses
463+
463464
# Check if process is alive before doing any heavy initialization
464465
if not _is_process_running(pid):
465466
print(f"No samples collected - process {pid} exited before profiling could begin.", file=sys.stderr)

0 commit comments

Comments
 (0)