Basic 'traceback' object support
Previously we were just passing around a vector<> of LineInfos; now, they get encapsulated in a BoxedTraceback object. This has a couple benefits: 1) they can participate in the existing sys.exc_info passing+handling 2) we can enable a basic form of the traceback module. 2 means that we can finally test our tracebacks support, since I was constantly fixing one issue only to break it in another place. 1 means that we now generate the right traceback for the current exception! Before this change, the traceback we would generate was determined using a different system than the exc_info-based exception raising, so sometimes they would diverge and be horribly confusing. There's a pretty big limitation with the current implementation: our tracebacks don't span the right stack frames. In CPython, a traceback spans the stack frames between the raise and the catch, but in Pyston the traceback includes all stack frames. It's not easy to provide this behavior, since the tracebacks are supposed to get updated as they get rethrown through each stack frame. We could do some complicated stuff in irgen to make sure this happens. I think the better but more complicated approach is for us to create the custom exception unwinder we've been wanting. This would let us add custom traceback-handling support as we unwound the stack. Another limitation is that tracebacks are supposed to automatically include a reference to the entire frame stack (tb.tb_frame.f_back.f_back.f_back....). In Pyston, we're not automatically generating those frame objects, so we would either need to do that and take a perf hit, or (more likely?) generate the frame objects on-demand when they're needed. It's not really clear that they're actually needed for traceback objects, so I implemented a different traceback object API and changed the traceback.py library, under the assumption that almost-noone actually deals with the traceback object internals.
Showing
src/runtime/traceback.cpp
0 → 100644
src/runtime/traceback.h
0 → 100644
Please register or sign in to comment