From 5299935be5acefae819bcc08a888a9466747d7cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Mon, 18 Feb 2008 17:40:47 +0000 Subject: [PATCH] Perform correct handling of stack overflow for windows: Catch the correct exception code and reset the overflow condition when handled. --- Python/pythonrun.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Python/pythonrun.c b/Python/pythonrun.c index ec31af10c9e..298d21862f3 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -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; }