Skip to content

Commit

Permalink
Perform correct handling of stack overflow for windows: Catch the cor…
Browse files Browse the repository at this point in the history
…rect exception code and reset the overflow condition when handled.
  • Loading branch information
Kristján Valur Jónsson committed Feb 18, 2008
1 parent d50a5f2 commit 5299935
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Python/pythonrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -1701,8 +1701,14 @@ PyOS_CheckStack(void)
not enough space left on the stack */
alloca(PYOS_STACK_MARGIN * sizeof(void*));
return 0;
} __except (EXCEPTION_EXECUTE_HANDLER) {
/* just ignore all errors */
} __except (GetExceptionCode() == STATUS_STACK_OVERFLOW ?
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
int errcode = _resetstkoflw();
if (errcode)
{
Py_FatalError("Could not reset the stack!");
}
}
return 1;
}
Expand Down

0 comments on commit 5299935

Please sign in to comment.