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

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


Jack Jansen writes:
 > I'm confused now: how is this counting-stack-limit different from
 > the maximum recursion depth we already have?

Because on Unix the maximum allowable stack space is not fixed (it can
be controlled by "ulimit" or "setrlimit"), so a hard-coded maximum
recursion depth is not appropriate.

 > The whole point of PyOS_StackCheck is to do an _actual_ check of
 > whether before we hit the hard limit.

 > If computing it is too difficult because getrlimit isn't available
 > or doesn't do what we want we should probe it

getrlimit is available and works fine.  It's getrusage that is
problematic.

I seriously think that instead of trying to slip this in `under the
wire' we should defer for 2.0b1 and try to do it right for either the
next 2.0x.  Getting this stuff right on Unix, portably, is tricky.
There may be a lot of different tricks required to make this work
right on different flavors of Unix.