On 10/29/05, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> Another point in PEP 352's favour, is that it makes it far more feasible to
> implement something like PEP 344 by providing "__traceback__" and
> "__prev_exc__" attributes on BaseException.

Not sure if I'm fully in-context here, but watch out for __traceback__
and garbage collection, since the traceback objects refer to all the
frames. I expect there's a significant amount of code out there that
expects Exception instances to be reasonably persistent. At least
Twisted does, with its encapsulation of Exceptions for the purposes of
asynchrony -- Failure objects. These Failure objects also refer to
tracebacks, but we had to be very careful about deleting them fairly
quickly because of GC issues. After deletion they simply contain an
inert, basically stringified copy of the traceback.

On an only semi-related note, at one point I tried making it possible
to have longer-lived Traceback objects that could be reraised, but
found it very hard to do, at least with my self-imposed requirement of
keeping it in an extension module.

http://mail.python.org/pipermail/python-dev/2005-September/056091.html



--
  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    -- http://radix.twistedmatrix.com
            |  Release Manager, Twisted Project
  \\\V///   |    -- http://twistedmatrix.com
   |o O|    |
w----v----w-+
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to