4 ms·
Huh, I was almost sure you were wrong and that I'd done this before, but the frame does indeed "go away" once you leave the except block. Fascinating. In [
by jsmthrowaway 9y ago
Huh, I was almost sure you were wrong and that I'd done this before, but the frame does indeed "go away" once you leave the except block. Fascinating.
In [8]: try: crasher()
...: except TypeError as e:
...: exc = e
...:
In [9]: type(exc)
Out[9]: TypeError
In [10]: traceback.print_tb(exc)
AttributeError: 'exceptions.TypeError' object has no attribute 'tb_frame'
I can understand the concern, though it seems like there would be easier fixes than the garbage collector for that specific case.