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

Jeremy Hylton jeremy@beopen.com
Tue, 29 Aug 2000 15:40:49 -0400 (EDT)


>>>>> "MAL" == M -A Lemburg <mal@lemburg.com> writes:

  >> I don't see an obvious solution.  Is there any way to implement
  >> PyOS_CheckStack on Unix?  I imagine that each platform would have
  >> its own variant and that there is no hope of getting them
  >> debugged before 2.0b1.

  MAL> I've looked around in the include files for Linux but haven't
  MAL> found any APIs which could be used to check the stack size.
  MAL> Not even getrusage() returns anything useful for the current
  MAL> stack size.

Right.  

  MAL> For the foo() example I found that on my machine the core dump
  MAL> happens at depth 9821 (counted from 0), so setting the
  MAL> recursion limit to something around 9000 should fix it at least
  MAL> for Linux2.

Right.  I had forgotten about the MAX_RECURSION_LIMIT.  It would
probably be better to set the limit lower on Linux only, right?  If
so, what's the cleanest was to make the value depend on the platform.

Jeremy