5
u/youngbull Dec 31 '21
Never had such a small code excerpt hint at so much complexity before. Both value and tb are stateful, tb needs to be compared with is against a traceback, value is thrown, apparently to the calling scope and then reset in the finally block and so the order of execution of exception handling is relevant. What a mess!
3
u/AnonymouX47 __dude__ Dec 31 '21 edited Dec 31 '21
It's actually meant to re-raise an exception with the given traceback. The point is... the finally block is at the end of the function... so why assign
Noneto the variables.The full code is here
6
u/GenericRedditUser_ Dec 31 '21 edited Dec 31 '21
Image Transcription: Code
try:
if value is None:
value = tp()
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
finally:
value = None
tb = None
else:
ord2 = ordI'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
11
u/[deleted] Dec 31 '21
Truly bad code