@@ -266,21 +266,21 @@ def print_exc_group(typ, exc, tb, prefix=""):
266266 for subline in line .rstrip ().splitlines ():
267267 print (f"{ prefix2 } | { subline } " , file = efile )
268268 lines = get_message_lines (typ , exc , tb )
269- for line in lines :
269+ for line in lines :
270270 print (f"{ prefix2 } | { line } " , end = "" , file = efile )
271271 for i , sub in enumerate (exc .exceptions , 1 ):
272272 if i == 1 :
273273 first_line_pre = "+-"
274274 else :
275- first_line_pre = " "
275+ first_line_pre = " "
276276 print (f"{ prefix2 } { first_line_pre } +---------------- { i } ----------------" , file = efile )
277277 if id (sub ) not in seen :
278278 if not prefix :
279279 print_exc (type (sub ), sub , sub .__traceback__ , " " )
280280 else :
281281 print_exc (type (sub ), sub , sub .__traceback__ , prefix + " " )
282282 need_print_underline = not isinstance (sub , BaseExceptionGroup )
283- else :
283+ else :
284284 print (f"{ prefix2 } | <exception { type (sub ).__name__ } has printed>" )
285285 need_print_underline = True
286286 if need_print_underline :
@@ -289,24 +289,23 @@ def print_exc_group(typ, exc, tb, prefix=""):
289289 def print_exc (typ , exc , tb , prefix = "" ):
290290 seen .add (id (exc ))
291291 context = exc .__context__
292- cause = exc .__cause__
293- prefix2 = f"{ prefix } | " if prefix else ""
292+ cause = exc .__cause__
293+ prefix2 = f"{ prefix } | " if prefix else ""
294294 if cause is not None and id (cause ) not in seen :
295295 print_exc (type (cause ), cause , cause .__traceback__ , prefix )
296296 print (f"{ prefix2 } \n { prefix2 } The above exception was the direct cause "
297297 f"of the following exception:\n { prefix2 } " , file = efile )
298298 elif (context is not None and
299299 not exc .__suppress_context__ and
300300 id (context ) not in seen ):
301- print_exc (type (context ), context , context .__traceback__ , prefix )
302-
301+ print_exc (type (context ), context , context .__traceback__ , prefix )
303302 print (f"{ prefix2 } \n { prefix2 } During handling of the above exception, "
304303 f"another exception occurred:\n { prefix2 } " , file = efile )
305304 if isinstance (exc , BaseExceptionGroup ):
306305 print_exc_group (typ , exc , tb , prefix = prefix )
307306 else :
308- if tb :
309- print (f"{ prefix2 } Traceback (most recent call last):" , file = efile )
307+ if tb :
308+ print (f"{ prefix2 } Traceback (most recent call last):" , file = efile )
310309 tbe = traceback .extract_tb (tb )
311310 cleanup_traceback (tbe , exclude )
312311 if prefix :
0 commit comments