summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-11-04 13:14:34 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-11-04 13:14:34 (GMT)
commitaab9c2b2ead7b786947c367a9cc5d9c921b9ea99 (patch)
tree323a662a1f65b39e90d28f9f259bc937467691a7 /Python/compile.c
parent1321edaa55a8df94e739e6ea5e9e658f2b7bfcc2 (diff)
downloadcpython-aab9c2b2ead7b786947c367a9cc5d9c921b9ea99.zip
cpython-aab9c2b2ead7b786947c367a9cc5d9c921b9ea99.tar.gz
cpython-aab9c2b2ead7b786947c367a9cc5d9c921b9ea99.tar.bz2
Issue #5765: Apply a hard recursion limit in the compiler
Previously, excessive nesting in expressions would blow the stack and segfault the interpreter. Now, a hard limit based on the configured recursion limit and a hardcoded scaling factor is applied.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index ff55220..5016f99 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -141,6 +141,11 @@ struct compiler_unit {
The u pointer points to the current compilation unit, while units
for enclosing blocks are stored in c_stack. The u and c_stack are
managed by compiler_enter_scope() and compiler_exit_scope().
+
+Note that we don't track recursion levels during compilation - the
+task of detecting and rejecting excessive levels of nesting is
+handled by the symbol analysis pass.
+
*/
struct compiler {