No, at finally
time sys.exc_info
is all-None, whether there has been an exception
or not. Use:
try:
whatever
except:
here sys.exc_info is valid
to re-raise the exception, use a bare `raise`
else:
here you know there was no exception
finally:
and here you can do exception-independent finalization
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…