[Python-checkins] cpython: Closes #22869: Move PyOS_CheckStack back to pythonrun.c
zach.ware
python-checkins at python.org
Sat Nov 22 06:37:43 CET 2014
https://hg.python.org/cpython/rev/406965684327
changeset: 93534:406965684327
user: Zachary Ware <zachary.ware at gmail.com>
date: Fri Nov 21 23:35:12 2014 -0600
summary:
Closes #22869: Move PyOS_CheckStack back to pythonrun.c
files:
Python/pylifecycle.c | 38 --------------------------------
Python/pythonrun.c | 37 +++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 38 deletions(-)
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1431,44 +1431,6 @@
}
-#if defined(USE_STACKCHECK)
-#if defined(WIN32) && defined(_MSC_VER)
-
-/* Stack checking for Microsoft C */
-
-#include <malloc.h>
-#include <excpt.h>
-
-/*
- * Return non-zero when we run out of memory on the stack; zero otherwise.
- */
-int
-PyOS_CheckStack(void)
-{
- __try {
- /* alloca throws a stack overflow exception if there's
- not enough space left on the stack */
- alloca(PYOS_STACK_MARGIN * sizeof(void*));
- return 0;
- } __except (GetExceptionCode() == STATUS_STACK_OVERFLOW ?
- EXCEPTION_EXECUTE_HANDLER :
- EXCEPTION_CONTINUE_SEARCH) {
- int errcode = _resetstkoflw();
- if (errcode == 0)
- {
- Py_FatalError("Could not reset the stack!");
- }
- }
- return 1;
-}
-
-#endif /* WIN32 && _MSC_VER */
-
-/* Alternate implementations can be added here... */
-
-#endif /* USE_STACKCHECK */
-
-
/* Wrappers around sigaction() or signal(). */
PyOS_sighandler_t
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1376,6 +1376,43 @@
}
+#if defined(USE_STACKCHECK)
+#if defined(WIN32) && defined(_MSC_VER)
+
+/* Stack checking for Microsoft C */
+
+#include <malloc.h>
+#include <excpt.h>
+
+/*
+ * Return non-zero when we run out of memory on the stack; zero otherwise.
+ */
+int
+PyOS_CheckStack(void)
+{
+ __try {
+ /* alloca throws a stack overflow exception if there's
+ not enough space left on the stack */
+ alloca(PYOS_STACK_MARGIN * sizeof(void*));
+ return 0;
+ } __except (GetExceptionCode() == STATUS_STACK_OVERFLOW ?
+ EXCEPTION_EXECUTE_HANDLER :
+ EXCEPTION_CONTINUE_SEARCH) {
+ int errcode = _resetstkoflw();
+ if (errcode == 0)
+ {
+ Py_FatalError("Could not reset the stack!");
+ }
+ }
+ return 1;
+}
+
+#endif /* WIN32 && _MSC_VER */
+
+/* Alternate implementations can be added here... */
+
+#endif /* USE_STACKCHECK */
+
/* Deprecated C API functions still provided for binary compatiblity */
#undef PyParser_SimpleParseFile
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list