comparison Python/pythonrun.c @ 45389:2efcd7f606f8 legacy-trunk

Perform correct handling of stack overflow for windows: Catch the correct exception code and reset the overflow condition when handled.
author Kristján Valur Jónsson <kristjan@ccpgames.com>
date Mon, 18 Feb 2008 17:40:47 +0000
parents 262263737bce
children 727f743cf630
comparison
equal deleted inserted replaced
45388:5087415054f1 45389:2efcd7f606f8
1699 __try { 1699 __try {
1700 /* alloca throws a stack overflow exception if there's 1700 /* alloca throws a stack overflow exception if there's
1701 not enough space left on the stack */ 1701 not enough space left on the stack */
1702 alloca(PYOS_STACK_MARGIN * sizeof(void*)); 1702 alloca(PYOS_STACK_MARGIN * sizeof(void*));
1703 return 0; 1703 return 0;
1704 } __except (EXCEPTION_EXECUTE_HANDLER) { 1704 } __except (GetExceptionCode() == STATUS_STACK_OVERFLOW ?
1705 /* just ignore all errors */ 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 }
1706 } 1712 }
1707 return 1; 1713 return 1;
1708 } 1714 }
1709 1715
1710 #endif /* WIN32 && _MSC_VER */ 1716 #endif /* WIN32 && _MSC_VER */