[Python-Dev] with_traceback

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Mar 2 05:05:12 CET 2007


Guido van Rossum wrote:
> You start with a traceback object pointing to the current frame
> object (traceback objects are distinct from frame objects,

Just out of curiosity, is it really necessary to have
a distinct traceback object? Couldn't the traceback
just be made of dead frame objects linked the opposite
way through their f_next pointers?

Seems to me it would be advantageous if raising an
exception (once it's created) could be done without
having to allocate any memory. Otherwise you could
get the situation where you're trying to raise a
MemoryError, but there's no memory to allocate a
traceback object, so you raise a MemoryError...
etc...

That might be a reason for pre-allocating the
MemoryError exception, too.

--
Greg


More information about the Python-Dev mailing list