[Python-Dev] Asynchronous use of Traceback objects
radeex at gmail.com
Mon Sep 5 02:34:00 CEST 2005
On 9/4/05, Michael Hudson <mwh at python.net> wrote:
> Christopher Armstrong <radeex at gmail.com> writes:
> > I had the idea to create a fake Traceback object in Python that
> > doesn't hold references to any frame objects, but is still able to be
> > passed to 'raise' and formatted as tracebacks are, etc. Unfortunately,
> > raise does a type check on its third argument and, besides, it seems
> > the traceback formatting functions are very reliant on the internal
> > structure of traceback objects, so that didn't work.
> An option you may not have considered is to ditch the C code that
> formats tracebacks and always use traceback.py (this has a few obvious
> problems -- what do you do if traceback.py fails to import, what if
> formatting the traceback raises an error -- but nothing too
> horrendous, I think).
> Less duplication and less C code are always good things (IMHO, at
The problem is, I can't tell Python to use traceback.py to format
specifically these tracebacks. Or are you suggesting replacing all of
Python's internal traceback printing stuff with traceback.py? I think
that's a great idea, and it's what I assumed happened before I found
these C-coded printing routines. On the other hand, that has the same
problem that the "change to python attribute access" has, specifically
that it *requires* a change to CPython itself, and can't be done in an
extension module. But that's a purely selfish concern. :)
I'm pretty close to getting the extension module that constructs
frames, but I'm dealing with segfaults now. Man, PyFrame_New does some
weird stuff. :) I may try for another day to get the extension module
working, then perhaps give up and try on one of the hacking-CPython
> > One concern is that I really don't like requiring C modules to use
> > Twisted; all of the ones currently in there are optional.
> Well, presumably this is optional too -- you only need it if you want
> informative tracebacks...
Yes, that's true.
Twisted | Christopher Armstrong: International Man of Twistery
Radix | -- http://radix.twistedmatrix.com
| Release Manager, Twisted Project
\\\V/// | -- http://twistedmatrix.com
|o O| |
More information about the Python-Dev