summaryrefslogtreecommitdiffstats
path: root/Python/symtable.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 0b259b0..342f5a0 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -278,7 +278,6 @@ _PySymtable_Build(mod_ty mod, PyObject *filename, PyFutureFeatures *future)
asdl_stmt_seq *seq;
int i;
PyThreadState *tstate;
- int recursion_limit = Py_GetRecursionLimit();
int starting_recursion_depth;
if (st == NULL)
@@ -298,12 +297,10 @@ _PySymtable_Build(mod_ty mod, PyObject *filename, PyFutureFeatures *future)
return NULL;
}
/* Be careful here to prevent overflow. */
- int recursion_depth = tstate->recursion_limit - tstate->recursion_remaining;
- starting_recursion_depth = (recursion_depth < INT_MAX / COMPILER_STACK_FRAME_SCALE) ?
- recursion_depth * COMPILER_STACK_FRAME_SCALE : recursion_depth;
+ int recursion_depth = C_RECURSION_LIMIT - tstate->c_recursion_remaining;
+ starting_recursion_depth = recursion_depth * COMPILER_STACK_FRAME_SCALE;
st->recursion_depth = starting_recursion_depth;
- st->recursion_limit = (recursion_limit < INT_MAX / COMPILER_STACK_FRAME_SCALE) ?
- recursion_limit * COMPILER_STACK_FRAME_SCALE : recursion_limit;
+ st->recursion_limit = C_RECURSION_LIMIT * COMPILER_STACK_FRAME_SCALE;
/* Make the initial symbol information gathering pass */
if (!symtable_enter_block(st, &_Py_ID(top), ModuleBlock, (void *)mod, 0, 0, 0, 0)) {