summaryrefslogtreecommitdiffstats
path: root/Include/pythonrun.h
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2025-02-24 10:16:08 (GMT)
committerGitHub <noreply@github.com>2025-02-24 10:16:08 (GMT)
commitef29104f7d7ad7864f5f153cd7391af73d7cef63 (patch)
tree38c76b08e114a9e6e993081b828b64978bfefa2e /Include/pythonrun.h
parent0ff16115741aeaaaf7f963f68d5c575efb960277 (diff)
downloadcpython-ef29104f7d7ad7864f5f153cd7391af73d7cef63.zip
cpython-ef29104f7d7ad7864f5f153cd7391af73d7cef63.tar.gz
cpython-ef29104f7d7ad7864f5f153cd7391af73d7cef63.tar.bz2
GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now (GH130413)
Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now Unfortunatlely, the change broke some buildbots. This reverts commit 2498c22fa0a2b560491bc503fa676585c1a603d0.
Diffstat (limited to 'Include/pythonrun.h')
-rw-r--r--Include/pythonrun.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 03b713b..154c745 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -21,18 +21,14 @@ PyAPI_FUNC(void) PyErr_DisplayException(PyObject *);
/* Stuff with no proper home (yet) */
PyAPI_DATA(int) (*PyOS_InputHook)(void);
-/* Stack size, in "pointers". This must be large enough, so
- * no two calls to check recursion depth are more than this far
- * apart. In practice, that means it must be larger than the C
- * stack consumption of PyEval_EvalDefault */
-#if defined(Py_DEBUG) && defined(WIN32)
-# define PYOS_STACK_MARGIN 3072
-#else
-# define PYOS_STACK_MARGIN 2048
-#endif
-#define PYOS_STACK_MARGIN_BYTES (PYOS_STACK_MARGIN * sizeof(void *))
-
-#if defined(WIN32)
+/* Stack size, in "pointers" (so we get extra safety margins
+ on 64-bit platforms). On a 32-bit platform, this translates
+ to an 8k margin. */
+#define PYOS_STACK_MARGIN 2048
+
+#if defined(WIN32) && !defined(MS_WIN64) && !defined(_M_ARM) && defined(_MSC_VER) && _MSC_VER >= 1300
+/* Enable stack checking under Microsoft C */
+// When changing the platforms, ensure PyOS_CheckStack() docs are still correct
#define USE_STACKCHECK
#endif