]> granicus.if.org Git - python/commitdiff
#3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Sat, 22 Nov 2008 20:01:18 +0000 (20:01 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Sat, 22 Nov 2008 20:01:18 +0000 (20:01 +0000)
stack overflow. But doing this, it always crashes when the stack is nearly full.

Reviewed by Martin von Loewis. Will backport to 2.6.

Misc/NEWS
Python/pythonrun.c

index c3f0ec61e1b77268ce5fc6770bfc2b0527d9672b..b7e80a9d2dfc2dbfd58eefde706dde6800551e4e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,10 @@ What's New in Python 2.7 alpha 1
 Core and Builtins
 -----------------
 
+- Issue #3996: On Windows, the PyOS_CheckStack function would cause the
+  interpreter to abort ("Fatal Python error: Could not reset the stack!")
+  instead of throwing a MemoryError.
+
 - Issue #4367: Python would segfault during compiling when the unicodedata
   module couldn't be imported and \N escapes were present.
 
index 4ff70d8543022f0292dd7fb4607160a8e5da5bf7..54f3c5784bd86b1384e07ad4214890a971111a2d 100644 (file)
@@ -1755,7 +1755,7 @@ PyOS_CheckStack(void)
                        EXCEPTION_EXECUTE_HANDLER : 
                        EXCEPTION_CONTINUE_SEARCH) {
                int errcode = _resetstkoflw();
-               if (errcode)
+               if (errcode == 0)
                {
                        Py_FatalError("Could not reset the stack!");
                }