From: Jack Jansen Date: Mon, 22 Jul 1996 15:25:10 +0000 (+0000) Subject: Added PyOS_CheckStack() function which returns -1 when we are running X-Git-Tag: v1.4b2~182 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ed9529a68bd28442a30b93f455d9575b05123cd;p=python Added PyOS_CheckStack() function which returns -1 when we are running low on stackspace. --- diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c index 74fa2eef73..e0cbd1a935 100644 --- a/Mac/Python/macglue.c +++ b/Mac/Python/macglue.c @@ -225,6 +225,20 @@ PyMac_Error(OSErr err) return PyErr_Mac(PyMac_GetOSErrException(), err); } +#ifdef USE_STACKCHECK +/* Check for stack overflow */ +int +PyOS_CheckStack() +{ + long left; + + left = StackSpace(); + if ( left < 4000 ) + return -1; + return 0; +} +#endif /* USE_STACKCHECK */ + /* The catcher routine (which may not be used for all compilers) */ static RETSIGTYPE intcatcher(sig)