diff 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
line wrap: on
line diff
--- a/Python/pythonrun.c	Mon Feb 18 14:25:02 2008 +0000
+++ b/Python/pythonrun.c	Mon Feb 18 17:40:47 2008 +0000
@@ -1701,8 +1701,14 @@
 		   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;
 }