At 07:38 PM 1/3/2007 -0800, Guido van Rossum wrote:
>On 1/3/07, Ka-Ping Yee <[EMAIL PROTECTED]> wrote:
> > On Wed, 3 Jan 2007, Adam Olsen wrote:
> > > 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.
> >
> > That seems like a reasonable approach to me. The implementation
> > might be tricky, but the behaviour sounds correct.
>
>Which reference are you exactly turning into a weak ref? The hidden
>reference in the frame's f_exc_traceback? Or the variable 'err' in
>
> except Exception, err: ...
>
>? The former goes away anyway so I'm not sure that this helps. And the
>latter seems fraught with peril; how do we even know which variables
>to treat this way? And why isn't it just as good to simply *delete*
>all locals that ever occurred in such a position in an except clause?
Or perhaps translate blocks of the form:
except ExcType, e:
# body
to:
except ExcType, e:
try:
# body
finally:
del e
This won't stop you from creating a cycle explicitly, of course, but it
would ensure that the simple cases would be cycle-free.
_______________________________________________
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