summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-10-17 13:29:30 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-10-17 13:29:30 (GMT)
commit14368158c2f7b646a170c0e31cdf115c0947a697 (patch)
tree8f03061dd280d153bd25df4dc62ec07967b464f2
parent93a569d6342215fbcf3d1df78184d669ac42527d (diff)
downloadcpython-14368158c2f7b646a170c0e31cdf115c0947a697.zip
cpython-14368158c2f7b646a170c0e31cdf115c0947a697.tar.gz
cpython-14368158c2f7b646a170c0e31cdf115c0947a697.tar.bz2
For debug build, check that the stack pointer never exceeds the stack size.
-rw-r--r--Python/ceval.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index ef99594..b0371aa 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -542,7 +542,9 @@ eval_frame(PyFrameObject *f)
#define BASIC_POP() (*--stack_pointer)
#ifdef LLTRACE
-#define PUSH(v) (void)(BASIC_PUSH(v), lltrace && prtrace(TOP(), "push"))
+#define PUSH(v) { (void)(BASIC_PUSH(v), \
+ lltrace && prtrace(TOP(), "push")); \
+ assert(STACK_LEVEL() <= f->f_stacksize); }
#define POP() ((void)(lltrace && prtrace(TOP(), "pop")), BASIC_POP())
#else
#define PUSH(v) BASIC_PUSH(v)