
When I look into tracebacks, it turns out to be just a chain like the frame chain, but upward down. It holds references to the frames in a 1-to-1 manner, and it keeps copies of f->f_lasti and f->f_lineno. I don't see why this is needed.
I'm thinking to replace the tracebacks by a single pointer in the frames for this purpose. It appears further to be possible to do that without any extra memory, since all the frames have extra temporary fields for exception info, and that isn't used in this context. Traceback objects exist each for one and only one frame, and they could be embedded into their frame.
Does this make sense? Do I miss something?
Yes. It is quite possible to have multiple stack traces lingering around that all point to the same stack frames. --Guido van Rossum (home page: http://www.python.org/~guido/)