Kaydet (Commit) 14a9171c authored tarafından Jack Jansen's avatar Jack Jansen

Cheaper implementation of PyOS_CheckStack: only call StackSpace once and keep a…

Cheaper implementation of PyOS_CheckStack: only call StackSpace once and keep a sentinel in a static variable.
üst a1a4b591
...@@ -410,10 +410,13 @@ PyMac_Error(OSErr err) ...@@ -410,10 +410,13 @@ PyMac_Error(OSErr err)
int int
PyOS_CheckStack() PyOS_CheckStack()
{ {
long left; char here;
static char *sentinel = 0;
left = StackSpace(); if ( sentinel == 0 ) {
if ( left < MINIMUM_STACK_SIZE ) sentinel = &here - StackSpace() + MINIMUM_STACK_SIZE;
}
if ( &here < sentinel )
return -1; return -1;
return 0; 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