On 12/28/06, Chris Mellon <[EMAIL PROTECTED]> wrote:
> On 28 Dec 2006 07:45:05 -0800, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > Maksim Kasimov:
> > > how to improve the situation depends on what do you expect to get by 
> > > calling "T().method()"
> >
> > You are right, sorry for being cryptic. I think that's a kind of bug of
> > Python (produced maybe by an infinite loop), so an improvement can be a
> > traceback or some automatic breaking of that loop. Note that my problem
> > comes from using Psyco that segfaults in that situation (if you have
> > Psyco installed you can decomment two lines to see that). I think that
> > using normal code Python+Psyco don't have to segfault, but I know this
> > is tricky situation, so if no simple "solutions" can be found, then
> > it's not a important thing and it can be ignored.
> >
>
> What I find most interesting is that you don't crash out because of
> hitting the recursion limit.    My brief testing shows something odd
> going on  - when the stack depth gets to almost 1000 (the recursion
> limit on my system) it knocks some stuff off the stack and the stack
> limit never gets to the limit. Some sort of built in tail recursion?
>

Nothing so clever. dir() eats and ignores all exceptions, so when you
hit the recursion limit it eats the RecursionLimitExceeded exception
and continues merrily along the way. This is probably not good
behavior...

class Foo:
    def __getattr__(self, attr):
        raise SystemExit, "Don't call me, again, ever"

f = Foo()
f.method() #dies correctly
dir(f) #continues happily
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to