summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2006-11-03 23:24:43 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2006-11-03 23:24:43 (GMT)
commit582529b442db759535075226bac5cb74b4b5c783 (patch)
treeb21863c4864afd6ce4e8ff900e3c7a8d28946a0a /generic
parent2afbba78fdfe1f2fb3310a5b778aac9ee5c5843c (diff)
downloadtcl-582529b442db759535075226bac5cb74b4b5c783.zip
tcl-582529b442db759535075226bac5cb74b4b5c783.tar.gz
tcl-582529b442db759535075226bac5cb74b4b5c783.tar.bz2
* generic/tclBasic.c (TEOVI):
* tests/trace.test (trace-21.11): fix for [Bug 1590232], execution traces may cause a second command resolution in the wrong namespace.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 71fa572..0f5c535 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.214 2006/11/02 16:39:06 dkf Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.215 2006/11/03 23:24:43 msofer Exp $
*/
#include "tclInt.h"
@@ -3279,6 +3279,7 @@ TclEvalObjvInternal(
int traceCode = TCL_OK;
int checkTraces = 1;
Namespace *savedNsPtr = NULL;
+ Namespace *lookupNsPtr = iPtr->lookupNsPtr;
if (TclInterpReady(interp) == TCL_ERROR) {
return TCL_ERROR;
@@ -3289,17 +3290,26 @@ TclEvalObjvInternal(
}
/*
+ * If any execution traces rename or delete the current command, we may
+ * need (at most) two passes here.
+ */
+
+ reparseBecauseOfTraces:
+
+ /*
* Configure evaluation context to match the requested flags.
*/
- if ((flags & TCL_EVAL_GLOBAL) && (varFramePtr != iPtr->rootFramePtr)) {
+ if ((flags & TCL_EVAL_GLOBAL) && (varFramePtr != iPtr->rootFramePtr)
+ && !savedVarFramePtr) {
varFramePtr = iPtr->rootFramePtr;
savedVarFramePtr = iPtr->varFramePtr;
iPtr->varFramePtr = varFramePtr;
} else if (flags & TCL_EVAL_INVOKE) {
savedNsPtr = varFramePtr->nsPtr;
- if (iPtr->lookupNsPtr) {
- varFramePtr->nsPtr = iPtr->lookupNsPtr;
+ if (lookupNsPtr) {
+ varFramePtr->nsPtr = lookupNsPtr;
+ iPtr->lookupNsPtr = NULL;
} else {
varFramePtr->nsPtr = iPtr->globalNsPtr;
}
@@ -3311,12 +3321,8 @@ TclEvalObjvInternal(
* If so, create a new word array with the handler as the first words and
* the original command words as arguments. Then call ourselves
* recursively to execute it.
- *
- * If any execution traces rename or delete the current command, we may
- * need (at most) two passes here.
*/
- reparseBecauseOfTraces:
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objv[0]);
if (cmdPtr == NULL) {
Namespace *currNsPtr = NULL; /* Used to check for and invoke any
@@ -3399,13 +3405,11 @@ TclEvalObjvInternal(
TclStackFree(interp);
if (savedNsPtr) {
varFramePtr->nsPtr = savedNsPtr;
- iPtr->lookupNsPtr = NULL;
}
goto done;
}
if (savedNsPtr) {
varFramePtr->nsPtr = savedNsPtr;
- iPtr->lookupNsPtr = NULL;
}
/*