On 4/18/06, Armin Rigo <[EMAIL PROTECTED]> wrote:
> Hi Brett,
>
> On Mon, Apr 17, 2006 at 05:34:16PM -0700, Brett Cannon wrote:
> > +       if (meth == self) {
> > +               PyErr_SetString(PyExc_RuntimeError,
> > +                               "recursive __call__ definition");
> > +               return NULL;
> > +       }
>
> This is not the proper way, as it can be worked around with a pair of
> objects whose __call__ point to each other.

Yeah, I know.  It was just a quick hack that at least helped me
identify where the problem was.  I didn't really expect for it to
stick around.

>  The solution is to use the
> counter of Py_{Enter,Leave}RecursiveCall(), as was done for old-style
> classes (see classobject.c).
>

OK.  Makes sense.

> By the way, this is a known problem: the example you show is
> Lib/test/crashers/infinite_rec_3.py, and the four other
> infinite_rec_*.py are all slightly more subtle ways to trigger a similar
> infinite loop in C.  They point to the SF bug report at
> http://python.org/sf/1202533, where we discuss the problem in general.
> Basically, someone should try to drop many
> Py_{Enter,Leave}RecursiveCall() pairs in the source until all the
> currently-known bugs go away, and then measure if this has a noticeable
> performance impact.
>

OK, good to know.  I will have to fix this eventually for sandboxing
reasons for my dissertation so I will get to it eventually.

-Brett
_______________________________________________
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