]> granicus.if.org Git - python/commitdiff
Perform correct handling of stack overflow for windows: Catch the correct exception...
authorKristján Valur Jónsson <kristjan@ccpgames.com>
Mon, 18 Feb 2008 17:40:47 +0000 (17:40 +0000)
committerKristján Valur Jónsson <kristjan@ccpgames.com>
Mon, 18 Feb 2008 17:40:47 +0000 (17:40 +0000)
Python/pythonrun.c

index ec31af10c9e02f39e3df2e65bb9220bca424986b..298d21862f3160561e96aec104f50f6c1fa5dfd3 100644 (file)
@@ -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;
 }