[Python-checkins] r60891 - python/trunk/Python/pythonrun.c

kristjan.jonsson python-checkins at python.org
Mon Feb 18 18:40:47 CET 2008


Author: kristjan.jonsson
Date: Mon Feb 18 18:40:47 2008
New Revision: 60891

Modified:
   python/trunk/Python/pythonrun.c
Log:
Perform correct handling of stack overflow for windows: Catch the correct exception code and reset the overflow condition when handled.

Modified: python/trunk/Python/pythonrun.c
==============================================================================
--- python/trunk/Python/pythonrun.c	(original)
+++ python/trunk/Python/pythonrun.c	Mon Feb 18 18:40:47 2008
@@ -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;
 }


More information about the Python-checkins mailing list