Re: [Python-Dev] safety of Py_CLEAR and self

2007-02-12 Thread Tim Peters
[Jeremy Hylton] > I was wondering today how I could convince myself that a sequence of > Py_CLEAR() calls in a tp_clear function was safe. Take for example a > really trivial sequence of code on frame_clear(): > > Py_CLEAR(f->f_exc_type); > Py_CLEAR(f->f_exc_value); > Py_CL

Re: [Python-Dev] safety of Py_CLEAR and self

2007-02-12 Thread Jeremy Hylton
On 2/12/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Looking for where tp_clear() is being called, the only caller is line > 713 in gmodule.c, which explicitly surrounds the call with an > INCREF/DECREF pair. Perhaps that's the clue you're looking for? Yes, of course. The INCREF guarantees t

Re: [Python-Dev] safety of Py_CLEAR and self

2007-02-12 Thread Guido van Rossum
Looking for where tp_clear() is being called, the only caller is line 713 in gmodule.c, which explicitly surrounds the call with an INCREF/DECREF pair. Perhaps that's the clue you're looking for? --Guido On 2/12/07, Jeremy Hylton <[EMAIL PROTECTED]> wrote: > I was wondering today how I could conv

[Python-Dev] safety of Py_CLEAR and self

2007-02-12 Thread Jeremy Hylton
I was wondering today how I could convince myself that a sequence of Py_CLEAR() calls in a tp_clear function was safe. Take for example a really trivial sequence of code on frame_clear(): Py_CLEAR(f->f_exc_type); Py_CLEAR(f->f_exc_value); Py_CLEAR(f->f_exc_traceback);