@@ -34,19 +34,22 @@ def __init__(self, pid, sample_interval_usec, all_threads, *, mode=PROFILING_MOD
3434 self .all_threads = all_threads
3535 self .mode = mode # Store mode for later use
3636 self .collect_stats = collect_stats
37- if _FREE_THREADED_BUILD :
38- self .unwinder = _remote_debugging .RemoteUnwinder (
39- self .pid , all_threads = self .all_threads , mode = mode , native = native , gc = gc ,
40- opcodes = opcodes , skip_non_matching_threads = skip_non_matching_threads ,
41- cache_frames = True , stats = collect_stats
42- )
43- else :
44- only_active_threads = bool (self .all_threads )
45- self .unwinder = _remote_debugging .RemoteUnwinder (
46- self .pid , only_active_thread = only_active_threads , mode = mode , native = native , gc = gc ,
47- opcodes = opcodes , skip_non_matching_threads = skip_non_matching_threads ,
48- cache_frames = True , stats = collect_stats
49- )
37+ try :
38+ if _FREE_THREADED_BUILD :
39+ self .unwinder = _remote_debugging .RemoteUnwinder (
40+ self .pid , all_threads = self .all_threads , mode = mode , native = native , gc = gc ,
41+ opcodes = opcodes , skip_non_matching_threads = skip_non_matching_threads ,
42+ cache_frames = True , stats = collect_stats
43+ )
44+ else :
45+ only_active_threads = bool (self .all_threads )
46+ self .unwinder = _remote_debugging .RemoteUnwinder (
47+ self .pid , only_active_thread = only_active_threads , mode = mode , native = native , gc = gc ,
48+ opcodes = opcodes , skip_non_matching_threads = skip_non_matching_threads ,
49+ cache_frames = True , stats = collect_stats
50+ )
51+ except Exception as err :
52+ raise SystemExit (err )
5053 # Track sample intervals and total sample count
5154 self .sample_intervals = deque (maxlen = 100 )
5255 self .total_samples = 0
0 commit comments