summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2003-06-10 19:46:34 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2003-06-10 19:46:34 (GMT)
commit06dfd692f84e8dec06b42f65482a77a9f5c09136 (patch)
treef99b43a3553ea52e187ef8667b27aa32ef732ad6 /generic
parent2de53852436287ca9c97b41636e38df538506625 (diff)
downloadtcl-06dfd692f84e8dec06b42f65482a77a9f5c09136.zip
tcl-06dfd692f84e8dec06b42f65482a77a9f5c09136.tar.gz
tcl-06dfd692f84e8dec06b42f65482a77a9f5c09136.tar.bz2
* generic/tclBasic.c:
* generic/tclExecute.c: let TclExecuteObjvInternal call TclInterpReady instead of relying on its callers to do so; fix for the part of [Bug 495830] that is new in 8.4. * tests/interp.test: Added tests 18.9 (knownbug) and 18.10
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c36
-rw-r--r--generic/tclExecute.c8
2 files changed, 19 insertions, 25 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 68dd065..cb7bb9e 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.83 2003/06/09 22:48:32 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.84 2003/06/10 19:46:42 msofer Exp $
*/
#include "tclInt.h"
@@ -2946,7 +2946,7 @@ TclInterpReady(interp)
* it's probably because of an infinite loop somewhere.
*/
- if (((iPtr->numLevels) >= iPtr->maxNestingDepth)
+ if (((iPtr->numLevels) > iPtr->maxNestingDepth)
|| (TclpCheckStackSpace() == 0)) {
Tcl_AppendToObj(Tcl_GetObjResult(interp),
"too many nested evaluations (infinite loop?)", -1);
@@ -2963,9 +2963,7 @@ TclInterpReady(interp)
*
* This procedure evaluates a Tcl command that has already been
* parsed into words, with one Tcl_Obj holding each word. The caller
- * is responsible for checking that the interpreter is ready to
- * evaluate (by calling TclInterpReady), and also to manage the
- * iPtr->numLevels.
+ * is responsible for managing the iPtr->numLevels.
*
* Results:
* The return value is a standard Tcl completion code such as
@@ -3013,6 +3011,10 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags)
int traceCode = TCL_OK;
int checkTraces = 1;
+ if (TclInterpReady(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
if (objc == 0) {
return TCL_OK;
}
@@ -3056,8 +3058,6 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags)
"invalid command name \"", Tcl_GetString(objv[0]), "\"",
(char *) NULL);
code = TCL_ERROR;
- } else if (TclInterpReady(interp) == TCL_ERROR) {
- code = TCL_ERROR;
} else {
iPtr->numLevels++;
code = TclEvalObjvInternal(interp, objc+1, newObjv, command, length, 0);
@@ -3218,13 +3218,9 @@ Tcl_EvalObjv(interp, objc, objv, flags)
}
}
- code = TclInterpReady(interp);
- if (code == TCL_OK) {
- iPtr->numLevels++;
- code = TclEvalObjvInternal(interp, objc, objv, cmdString, cmdLen,
- flags);
- iPtr->numLevels--;
- }
+ iPtr->numLevels++;
+ code = TclEvalObjvInternal(interp, objc, objv, cmdString, cmdLen, flags);
+ iPtr->numLevels--;
/*
* If we are again at the top level, process any unusual
@@ -3540,14 +3536,10 @@ Tcl_EvalEx(interp, script, numBytes, flags)
* Execute the command and free the objects for its words.
*/
- if (TclInterpReady(interp) == TCL_ERROR) {
- code = TCL_ERROR;
- } else {
- iPtr->numLevels++;
- code = TclEvalObjvInternal(interp, objectsUsed, objv,
- parse.commandStart, parse.commandSize, 0);
- iPtr->numLevels--;
- }
+ iPtr->numLevels++;
+ code = TclEvalObjvInternal(interp, objectsUsed, objv,
+ parse.commandStart, parse.commandSize, 0);
+ iPtr->numLevels--;
if (code != TCL_OK) {
if (iPtr->numLevels == 0) {
if (code == TCL_RETURN) {
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 0697677..4c48584 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.101 2003/05/05 20:54:39 dgp Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.102 2003/06/10 19:46:44 msofer Exp $
*/
#include "tclInt.h"
@@ -894,7 +894,9 @@ TclCompEvalObj(interp, objPtr)
* Check that the interpreter is ready to execute scripts
*/
+ iPtr->numLevels++;
if (TclInterpReady(interp) == TCL_ERROR) {
+ iPtr->numLevels--;
return TCL_ERROR;
}
@@ -980,9 +982,7 @@ TclCompEvalObj(interp, objPtr)
iPtr->returnOpts = iPtr->defaultReturnOpts;
Tcl_IncrRefCount(iPtr->returnOpts);
}
- iPtr->numLevels++;
result = TclExecuteByteCode(interp, codePtr);
- iPtr->numLevels--;
codePtr->refCount--;
if (codePtr->refCount <= 0) {
TclCleanupByteCode(codePtr);
@@ -990,6 +990,8 @@ TclCompEvalObj(interp, objPtr)
} else {
result = TCL_OK;
}
+ iPtr->numLevels--;
+
/*
* If no commands at all were executed, check for asynchronous