diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2003-06-10 19:58:25 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2003-06-10 19:58:25 (GMT) |
commit | 41152a87fec3bad8027d75beb232fd8521e58387 (patch) | |
tree | a89c6d5cb9c9431ba2df9e76e0b0de0ee9bcae8c /generic/tclBasic.c | |
parent | 031fff50ca31c281d98756a100869ae708c13f87 (diff) | |
download | tcl-41152a87fec3bad8027d75beb232fd8521e58387.zip tcl-41152a87fec3bad8027d75beb232fd8521e58387.tar.gz tcl-41152a87fec3bad8027d75beb232fd8521e58387.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/tclBasic.c')
-rw-r--r-- | generic/tclBasic.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 8eda27e..80f5bda 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.75.2.3 2003/05/12 20:16:08 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.75.2.4 2003/06/10 19:58:34 msofer Exp $ */ #include "tclInt.h" @@ -2919,7 +2919,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); @@ -2936,9 +2936,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 @@ -2986,6 +2984,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; } @@ -3029,8 +3031,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); @@ -3191,13 +3191,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 @@ -3666,14 +3662,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) { |