Skip to content

Commit 2a48972

Browse files
author
kristjan.jonsson
committed
Perform correct handling of stack overflow for windows: Catch the correct exception code and reset the overflow condition when handled.
git-svn-id: http://svn.python.org/projects/python/trunk@60891 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 4b78fd9 commit 2a48972

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Python/pythonrun.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,8 +1701,14 @@ PyOS_CheckStack(void)
17011701
not enough space left on the stack */
17021702
alloca(PYOS_STACK_MARGIN * sizeof(void*));
17031703
return 0;
1704-
} __except (EXCEPTION_EXECUTE_HANDLER) {
1705-
/* just ignore all errors */
1704+
} __except (GetExceptionCode() == STATUS_STACK_OVERFLOW ?
1705+
EXCEPTION_EXECUTE_HANDLER :
1706+
EXCEPTION_CONTINUE_SEARCH) {
1707+
int errcode = _resetstkoflw();
1708+
if (errcode)
1709+
{
1710+
Py_FatalError("Could not reset the stack!");
1711+
}
17061712
}
17071713
return 1;
17081714
}

0 commit comments

Comments
 (0)