[Python-Dev] stack check on Unix: any suggestions?

Charles G Waldman cgw@fnal.gov
Thu, 31 Aug 2000 10:50:38 -0500 (CDT)


Guido van Rossum writes:
 > > > Please try this again on various platforms with this version:
 > > > 
 > > >     i = 0
 > > >     class C:
 > > >       def __getattr__(self, name):
 > > >           global i
 > > >           print i
 > > >           i += 1
 > > >           return self.name # common beginners' mistake
 > > > 
 > > >     C() # This tries to get __init__, triggering the recursion
 > > > 
 > > > I get 5788 iterations on Red Hat Linux 6.2 (ulimit -c says 8192; I
 > > > have no idea what units).

I get a core dump after 4824 iterations on a not-quite-Red-Hat box,
with an 8MB stack limit.

What about the idea that was suggested to use a sigsegv catcher?  Or
reading info from /proc (yes, there is a lot of overhead here, but if
we do in infrequently enough we might just get away with it.  It could
be a configure-time option disable by default).  I still think there
are even more tricks possible here, and we should pursue this after
2.0b1.  I volunteer to help work on it ;-)