Index: generic/tclExecute.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclExecute.c,v
retrieving revision 1.161
diff -u -r1.161 tclExecute.c
--- generic/tclExecute.c	25 Oct 2004 01:06:49 -0000	1.161
+++ generic/tclExecute.c	25 Oct 2004 19:03:56 -0000
@@ -1237,10 +1237,7 @@
 	    int level = TclGetUInt4AtPtr(pc+5);
 	    Tcl_Obj *returnOpts = POP_OBJECT();
 
-	    DECACHE_STACK_INFO();
-	    Tcl_ResetResult(interp);
 	    result = TclProcessReturn(interp, code, level, returnOpts);
-	    CACHE_STACK_INFO();
 	    Tcl_DecrRefCount(returnOpts);
 	    if (result != TCL_OK) {
 		Tcl_SetObjResult(interp, *tosPtr);
@@ -2186,9 +2183,7 @@
 		 if (result != TCL_OK) {
 		     TRACE_WITH_OBJ(("%u (by %s) => ERROR converting increment amount to int: ",
 			     opnd, O2S(objPtr)), Tcl_GetObjResult(interp));
-		     DECACHE_STACK_INFO();
 		     Tcl_AddErrorInfo(interp, "\n    (reading increment)");
-		     CACHE_STACK_INFO();
 		     goto checkForCatch;
 		 }
 		 isWide = (objPtr->typePtr == &tclWideIntType);
@@ -2231,10 +2226,8 @@
 	     varPtr = TclObjLookupVar(interp, objPtr, part2, 
 		     TCL_LEAVE_ERR_MSG, "read", 0, 1, &arrayPtr);
 	     if (varPtr == NULL) {
-		 DECACHE_STACK_INFO();
 		 Tcl_AddObjErrorInfo(interp,
 			 "\n    (reading value of variable to increment)", -1);
-		 CACHE_STACK_INFO();
 		 TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
 		 result = TCL_ERROR;
 		 goto checkForCatch;
@@ -2516,9 +2509,7 @@
 	    if (result != TCL_OK) {
 		TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(valuePtr),
 		        (t1Ptr? t1Ptr->name : "null")));
-		DECACHE_STACK_INFO();
 		IllegalExprOperandType(interp, pc, valuePtr);
-		CACHE_STACK_INFO();
 		goto checkForCatch;
 	    }
 	}
@@ -2547,9 +2538,7 @@
 	    if (result != TCL_OK) {
 		TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(value2Ptr),
 		        (t2Ptr? t2Ptr->name : "null")));
-		DECACHE_STACK_INFO();
 		IllegalExprOperandType(interp, pc, value2Ptr);
-		CACHE_STACK_INFO();
 		goto checkForCatch;
 	    }
 	}
@@ -3491,9 +3480,7 @@
 		        O2S(valuePtr), O2S(value2Ptr), 
 		        (valuePtr->typePtr? 
 			     valuePtr->typePtr->name : "null")));
-		DECACHE_STACK_INFO();
 		IllegalExprOperandType(interp, pc, valuePtr);
-		CACHE_STACK_INFO();
 		goto checkForCatch;
 	    }
 	}
@@ -3508,9 +3495,7 @@
 		        O2S(valuePtr), O2S(value2Ptr),
 		        (value2Ptr->typePtr?
 			    value2Ptr->typePtr->name : "null")));
-		DECACHE_STACK_INFO();
 		IllegalExprOperandType(interp, pc, value2Ptr);
-		CACHE_STACK_INFO();
 		goto checkForCatch;
 	    }
 	}
@@ -3825,9 +3810,7 @@
 		        s, O2S(valuePtr),
 		        (valuePtr->typePtr?
 			    valuePtr->typePtr->name : "null")));
-		DECACHE_STACK_INFO();
 		IllegalExprOperandType(interp, pc, valuePtr);
-		CACHE_STACK_INFO();
 		goto checkForCatch;
 	    }
 	    t1Ptr = valuePtr->typePtr;
@@ -3859,9 +3842,7 @@
 		        O2S(value2Ptr), s,
 		        (value2Ptr->typePtr?
 			    value2Ptr->typePtr->name : "null")));
-		DECACHE_STACK_INFO();
 		IllegalExprOperandType(interp, pc, value2Ptr);
-		CACHE_STACK_INFO();
 		goto checkForCatch;
 	    }
 	    t2Ptr = value2Ptr->typePtr;
@@ -3914,9 +3895,7 @@
 	    if (IS_NAN(dResult) || IS_INF(dResult)) {
 		TRACE(("%.20s %.20s => IEEE FLOATING PT ERROR\n",
 		        O2S(valuePtr), O2S(value2Ptr)));
-		DECACHE_STACK_INFO();
 		TclExprFloatError(interp, dResult);
-		CACHE_STACK_INFO();
 		result = TCL_ERROR;
 		goto checkForCatch;
 	    }
@@ -4092,9 +4071,7 @@
 	    if (result != TCL_OK) { 
 		TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n",
 		        s, (tPtr? tPtr->name : "null")));
-		DECACHE_STACK_INFO();
 		IllegalExprOperandType(interp, pc, valuePtr);
-		CACHE_STACK_INFO();
 		goto checkForCatch;
 	    }
 	    tPtr = valuePtr->typePtr;
@@ -4182,9 +4159,7 @@
 		if (result != TCL_OK) {
 		    TRACE(("\"%.20s\" => ILLEGAL TYPE %s\n",
 		            s, (tPtr? tPtr->name : "null")));
-		    DECACHE_STACK_INFO();
 		    IllegalExprOperandType(interp, pc, valuePtr);
-		    CACHE_STACK_INFO();
 		    goto checkForCatch;
 		}
 	    }
@@ -4277,9 +4252,7 @@
 	    if (result != TCL_OK) {   /* try to convert to double */
 		TRACE(("\"%.20s\" => ILLEGAL TYPE %s\n",
 		        O2S(valuePtr), (tPtr? tPtr->name : "null")));
-		DECACHE_STACK_INFO();
 		IllegalExprOperandType(interp, pc, valuePtr);
-		CACHE_STACK_INFO();
 		goto checkForCatch;
 	    }
 	}
@@ -4459,9 +4432,7 @@
 		if (IS_NAN(d) || IS_INF(d)) {
 		    TRACE(("\"%.20s\" => IEEE FLOATING PT ERROR\n",
 		            O2S(objResultPtr)));
-		    DECACHE_STACK_INFO();
 		    TclExprFloatError(interp, d);
-		    CACHE_STACK_INFO();
 		    result = TCL_ERROR;
 		    goto checkForCatch;
 		}
@@ -4730,11 +4701,9 @@
      */
 	
  divideByZero:
-    DECACHE_STACK_INFO();
     Tcl_SetObjResult(interp, Tcl_NewStringObj("divide by zero", -1));
     Tcl_SetErrorCode(interp, "ARITH", "DIVZERO", "divide by zero",
             (char *) NULL);
-    CACHE_STACK_INFO();
 
     result = TCL_ERROR;
     goto checkForCatch;
@@ -4745,12 +4714,10 @@
      */
 
  exponOfZero:
-    DECACHE_STACK_INFO();
     Tcl_SetObjResult(interp, Tcl_NewStringObj(
 	    "exponentiation of zero by negative power", -1));
     Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
 	    "exponentiation of zero by negative power", (char *) NULL);
-    CACHE_STACK_INFO();
     result = TCL_ERROR;
     goto checkForCatch;
 
@@ -4862,9 +4829,7 @@
 	if ((result == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) {
 	    bytes = GetSrcInfoForPc(pc, codePtr, &length);
 	    if (bytes != NULL) {
-		DECACHE_STACK_INFO();
 		Tcl_LogCommandInfo(interp, codePtr->source, bytes, length);
-		CACHE_STACK_INFO();
 	    }
 	}
 	iPtr->flags &= ~ERR_ALREADY_LOGGED;
@@ -5146,7 +5111,7 @@
 	operator = "**";
     }
 
-    Tcl_ResetResult(interp);
+    Tcl_SetObjResult(interp, Tcl_NewObj());
     if ((opndPtr->bytes == NULL) || (opndPtr->length == 0)) {
 	Tcl_AppendResult(interp, "can't use empty string as operand of \"",
 		operator, "\"", (char *) NULL);
Index: generic/tclResult.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclResult.c,v
retrieving revision 1.20
diff -u -r1.20 tclResult.c
--- generic/tclResult.c	24 Oct 2004 22:25:13 -0000	1.20
+++ generic/tclResult.c	25 Oct 2004 19:03:56 -0000
@@ -1186,14 +1186,15 @@
     }
 
     if (code == TCL_ERROR) {
+	if (iPtr->errorInfo) {
+	    Tcl_DecrRefCount(iPtr->errorInfo);
+	    iPtr->errorInfo = NULL;
+	}
 	Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORINFO], &valuePtr);
 	if (valuePtr != NULL) {
 	    int infoLen;
 	    (void) Tcl_GetStringFromObj(valuePtr, &infoLen);
 	    if (infoLen) {
-		if (iPtr->errorInfo) {
-		    Tcl_DecrRefCount(iPtr->errorInfo);
-		}
 		iPtr->errorInfo = valuePtr;
 		Tcl_IncrRefCount(iPtr->errorInfo);
 		iPtr->flags |= ERR_ALREADY_LOGGED;
