summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-01-17 21:05:28 (GMT)
committerGuido van Rossum <guido@python.org>1997-01-17 21:05:28 (GMT)
commit62f7d15d0bc83f2b1a78cca79691ad65de15381e (patch)
treebf6bbd929eb6bb7d8b40304ea505ffa4d3ef6178 /Python
parent8b993a98db507cc3a75067af4c865ffc8afbada1 (diff)
downloadcpython-62f7d15d0bc83f2b1a78cca79691ad65de15381e.zip
cpython-62f7d15d0bc83f2b1a78cca79691ad65de15381e.tar.gz
cpython-62f7d15d0bc83f2b1a78cca79691ad65de15381e.tar.bz2
Use the stack size from the code object and the CO_MAXBLOCKS constant
from compile.h. Remove all eval stack overflow checks.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 816973f..dbfaf7d 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -364,8 +364,10 @@ eval_code2(co, globals, locals,
#define BASIC_PUSH(v) (*stack_pointer++ = (v))
#define BASIC_POP() (*--stack_pointer)
+#if 0
#define CHECK_STACK(n) (STACK_LEVEL() + (n) < f->f_nvalues || \
(stack_pointer = extend_stack(f, STACK_LEVEL(), n)))
+#endif
#ifdef LLTRACE
#define PUSH(v) (BASIC_PUSH(v), lltrace && prtrace(TOP(), "push"))
@@ -403,8 +405,8 @@ eval_code2(co, globals, locals,
globals, /*globals*/
locals, /*locals*/
owner, /*owner*/
- 50, /*nvalues*/
- 20); /*nblocks*/
+ co->co_stacksize, /*nvalues*/
+ CO_MAXBLOCKS); /*nblocks*/
if (f == NULL)
return NULL;
@@ -626,10 +628,12 @@ eval_code2(co, globals, locals,
}
#endif
+#ifdef CHECK_STACK
if (!CHECK_STACK(3)) {
x = NULL;
break;
}
+#endif
/* Main switch on opcode */
@@ -1097,10 +1101,12 @@ eval_code2(co, globals, locals,
why = WHY_EXCEPTION;
}
else {
+#ifdef CHECK_STACK
if (!CHECK_STACK(oparg)) {
x = NULL;
break;
}
+#endif
for (; --oparg >= 0; ) {
w = GETTUPLEITEM(v, oparg);
INCREF(w);
@@ -1122,10 +1128,12 @@ eval_code2(co, globals, locals,
why = WHY_EXCEPTION;
}
else {
+#ifdef CHECK_STACK
if (!CHECK_STACK(oparg)) {
x = NULL;
break;
}
+#endif
for (; --oparg >= 0; ) {
w = getlistitem(v, oparg);
INCREF(w);