Commit 14a9171c authored by Jack Jansen's avatar Jack Jansen

Cheaper implementation of PyOS_CheckStack: only call StackSpace once and keep...

Cheaper implementation of PyOS_CheckStack: only call StackSpace once and keep a sentinel in a static variable.
parent a1a4b591
......@@ -410,10 +410,13 @@ PyMac_Error(OSErr err)
int
PyOS_CheckStack()
{
long left;
char here;
static char *sentinel = 0;
left = StackSpace();
if ( left < MINIMUM_STACK_SIZE )
if ( sentinel == 0 ) {
sentinel = &here - StackSpace() + MINIMUM_STACK_SIZE;
}
if ( &here < sentinel )
return -1;
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment