File tree Expand file tree Collapse file tree
test/test_profiling/test_sampling_profiler Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -875,13 +875,15 @@ def _validate_args(args, parser):
875875 if hasattr (args , 'live' ) and args .live :
876876 parser .error ("--subprocesses is incompatible with --live mode." )
877877
878- # Async-aware mode is incompatible with --native, --no-gc, --mode, and --all-threads
878+ # Async-aware mode is incompatible with options that need thread data.
879879 if getattr (args , 'async_aware' , False ):
880880 issues = []
881881 if getattr (args , 'native' , False ):
882882 issues .append ("--native" )
883883 if not getattr (args , 'gc' , True ):
884884 issues .append ("--no-gc" )
885+ if getattr (args , 'format' , None ) == "binary" :
886+ issues .append ("--binary" )
885887 if hasattr (args , 'mode' ) and args .mode != "wall" :
886888 issues .append (f"--mode={ args .mode } " )
887889 if hasattr (args , 'all_threads' ) and args .all_threads :
Original file line number Diff line number Diff line change @@ -866,6 +866,23 @@ def test_async_aware_incompatible_with_all_threads(self):
866866 self .assertIn ("--all-threads" , error_msg )
867867 self .assertIn ("incompatible with --async-aware" , error_msg )
868868
869+ def test_async_aware_incompatible_with_binary (self ):
870+ """Test --async-aware is incompatible with --binary."""
871+ test_args = ["profiling.sampling.cli" , "attach" , "12345" ,
872+ "--async-aware" , "--binary" ]
873+
874+ with (
875+ mock .patch ("sys.argv" , test_args ),
876+ mock .patch ("sys.stderr" , io .StringIO ()) as mock_stderr ,
877+ self .assertRaises (SystemExit ) as cm ,
878+ ):
879+ main ()
880+
881+ self .assertEqual (cm .exception .code , 2 ) # argparse error
882+ error_msg = mock_stderr .getvalue ()
883+ self .assertIn ("--binary" , error_msg )
884+ self .assertIn ("incompatible with --async-aware" , error_msg )
885+
869886 @unittest .skipIf (is_emscripten , "subprocess not available" )
870887 def test_run_nonexistent_script_exits_cleanly (self ):
871888 """Test that running a non-existent script exits with a clean error."""
You can’t perform that action at this time.
0 commit comments