File tree Expand file tree Collapse file tree 2 files changed +26
-8
lines changed
test/test_profiling/test_sampling_profiler Expand file tree Collapse file tree 2 files changed +26
-8
lines changed Original file line number Diff line number Diff line change 3535 SORT_MODE_NSAMPLES_CUMUL ,
3636)
3737
38- from ._child_monitor import ChildProcessMonitor
38+ try :
39+ from ._child_monitor import ChildProcessMonitor
40+ except ImportError :
41+ # _remote_debugging module not available on this platform (e.g., WASI)
42+ ChildProcessMonitor = None
3943
4044try :
4145 from .live_collector import LiveStatsCollector
@@ -654,6 +658,11 @@ def _validate_args(args, parser):
654658
655659 # --subprocesses is incompatible with --live
656660 if hasattr (args , 'subprocesses' ) and args .subprocesses :
661+ if ChildProcessMonitor is None :
662+ parser .error (
663+ "--subprocesses is not available on this platform "
664+ "(requires _remote_debugging module)."
665+ )
657666 if hasattr (args , 'live' ) and args .live :
658667 parser .error ("--subprocesses is incompatible with --live mode." )
659668
Original file line number Diff line number Diff line change 3535 is_python_process = None
3636 _MAX_CHILD_PROFILERS = None
3737 _CLEANUP_INTERVAL_CYCLES = None
38- from profiling .sampling .cli import (
39- _add_sampling_options ,
40- _validate_args ,
41- _build_child_profiler_args ,
42- _build_output_pattern ,
43- _setup_child_monitor ,
44- )
38+
39+ try :
40+ from profiling .sampling .cli import (
41+ _add_sampling_options ,
42+ _validate_args ,
43+ _build_child_profiler_args ,
44+ _build_output_pattern ,
45+ _setup_child_monitor ,
46+ )
47+ except ImportError :
48+ # cli module imports sample module which requires _remote_debugging
49+ _add_sampling_options = None
50+ _validate_args = None
51+ _build_child_profiler_args = None
52+ _build_output_pattern = None
53+ _setup_child_monitor = None
4554
4655from .helpers import _cleanup_process
4756
You can’t perform that action at this time.
0 commit comments