summaryrefslogtreecommitdiffstats
path: root/Python/symtable.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-01-16 09:32:01 (GMT)
committerGitHub <noreply@github.com>2024-01-16 09:32:01 (GMT)
commit17b73ab99ef12f89d41acec7500a244e68b1aaa4 (patch)
treebcde8fca4dc4dae4f9ed5369a4ea23bb825f15bb /Python/symtable.c
parent6c502ba809ff662a5eebf8c6778dec6bd28918fb (diff)
downloadcpython-17b73ab99ef12f89d41acec7500a244e68b1aaa4.zip
cpython-17b73ab99ef12f89d41acec7500a244e68b1aaa4.tar.gz
cpython-17b73ab99ef12f89d41acec7500a244e68b1aaa4.tar.bz2
GH-113655: Lower the C recursion limit on various platforms (GH-113944)
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 83137b4..7430299 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -386,11 +386,6 @@ symtable_new(void)
return NULL;
}
-/* Using a scaling factor means this should automatically adjust when
- the recursion limit is adjusted for small or large C stack allocations.
-*/
-#define COMPILER_STACK_FRAME_SCALE 2
-
struct symtable *
_PySymtable_Build(mod_ty mod, PyObject *filename, PyFutureFeatures *future)
{
@@ -417,9 +412,9 @@ _PySymtable_Build(mod_ty mod, PyObject *filename, PyFutureFeatures *future)
}
/* Be careful here to prevent overflow. */
int recursion_depth = Py_C_RECURSION_LIMIT - tstate->c_recursion_remaining;
- starting_recursion_depth = recursion_depth * COMPILER_STACK_FRAME_SCALE;
+ starting_recursion_depth = recursion_depth;
st->recursion_depth = starting_recursion_depth;
- st->recursion_limit = Py_C_RECURSION_LIMIT * COMPILER_STACK_FRAME_SCALE;
+ st->recursion_limit = Py_C_RECURSION_LIMIT;
/* Make the initial symbol information gathering pass */
if (!symtable_enter_block(st, &_Py_ID(top), ModuleBlock, (void *)mod, 0, 0, 0, 0)) {