On 1/2/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > On 1/1/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > will introduce a cycle from err -> traceback -> stack frame -> err,
> The problem with a weakref is that it won't keep the tb alive when you > save the exception for later (as is done for instance by the unittest > module). So it is of limited value and could even be confusing. OTOH > it *does* remove the need to call sys.exc_info() in the most common > case, so I don't want to rule it out completely. That can be solved by moving the weakref to the stack frame -> exc part, and only turning it from a strong reference into a weak reference when the function exits. When debugging via the raised exception, the chain of __context__ references would keep it alive. The disadvantage is it requires the local variable created by "except Exception, exc" be special, perhaps not allowing any further assignment to it or other limitations. -- Adam Olsen, aka Rhamphoryncus _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
