[Python-Dev] Why do we need Traceback Objects?

Christian Tismer tismer@tismer.com
Wed, 05 Apr 2000 16:29:03 +0200


Hi,

while fixing my design flaws after Just's Stackless Mac port,
I was dealing with some overflow conditions and tracebacks.

When there is a recursion depth overflow condition, we create
a lot of new structure for the tracebacks.
This usually happens in a situation where memory is quite
exhausted. Even worse if we crash because of a memory error:
The system will not have enough memory to build the traceback
structure, to report the error. Puh :-)

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?

I'm considering this for Stackless and would like to know
if I should prepare it for orthodox Python as well?

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com