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

Skip Montanaro skip@mojam.com (Skip Montanaro)
Thu, 6 Apr 2000 08:08:14 -0500 (CDT)


    Vladimir> This reminds me that some time ago I made an experimental
    Vladimir> patch for removing SET_LINENO. There was the problem of
    Vladimir> generating callbacks for pdb (which I think I solved somehow
    Vladimir> but I don't remember the details). I do remember that I had to
    Vladimir> look at pdb again for some reason. Is there any interest in
    Vladimir> reviving this idea?

I believe you can get line number information from a code object's co_lnotab
attribute, though I don't know the format.  I think this should be
sufficient to allow SET_LINENO to be eliminated altogether.  It's just that
there are places in various modules that predate the appearance of
co_lnotab.

Whoops, wait a minute.  I just tried

    >>> def foo(): pass
    ... 
    >>> foo.func_code.co_lnotab 

with both "python" and "python -O".  co_lnotab is empty for python -O.  I
thought it was supposed to always be generated?

-- 
Skip Montanaro | http://www.mojam.com/
skip@mojam.com | http://www.musi-cal.com/