@@ -326,37 +326,6 @@ def test_log_subject_hierarchy(self):
326326 finally :
327327 logger .removeHandler (handler )
328328
329- def test_callback_exception_does_not_crash (self ):
330- """If a logging handler raises, CRT should not crash and subsequent logging should still work."""
331-
332- class BrokenHandler (logging .Handler ):
333- def emit (self , record ):
334- raise RuntimeError ("handler exploded" )
335-
336- logger = logging .getLogger ('awscrt' )
337- logger .setLevel (logging .DEBUG )
338- broken = BrokenHandler ()
339- logger .addHandler (broken )
340-
341- try :
342- # This triggers the C callback -> Python callback -> handler.emit -> raise
343- # Should not crash or leave the process in a bad state
344- log (logging .INFO , LogSubject .COMMON_GENERAL , "this should not crash" )
345- finally :
346- logger .removeHandler (broken )
347-
348- # Verify logging still works after the error
349- good = logging .Handler ()
350- good .records = []
351- good .emit = lambda record : good .records .append (record )
352- logger .addHandler (good )
353- try :
354- log (logging .INFO , LogSubject .COMMON_GENERAL , "after error" )
355- self .assertEqual (len (good .records ), 1 )
356- self .assertIn ("after error" , good .records [0 ].getMessage ())
357- finally :
358- logger .removeHandler (good )
359-
360329 def _emit_all_subjects_and_levels (self ):
361330 """Emit logs across all subjects at INFO and DEBUG levels."""
362331 for subject in (LogSubject .IO_EVENT_LOOP , LogSubject .HTTP_GENERAL ,
0 commit comments