Index: generic/tclBasic.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v
retrieving revision 1.323
diff -u -r1.323 tclBasic.c
--- generic/tclBasic.c	21 Jul 2008 23:46:51 -0000	1.323
+++ generic/tclBasic.c	22 Jul 2008 20:55:05 -0000
@@ -3161,7 +3161,7 @@
     int numChars;
 
     objPtr = Tcl_NewListObj(objc, objv);
-    if (lookup && cfPtr) {
+    if (lookup && cfPtr && (cfPtr->numLevels == iPtr->numLevels-1)) {
 	switch (cfPtr->type) {
 	case TCL_LOCATION_EVAL:
 	case TCL_LOCATION_SOURCE:
@@ -4910,6 +4910,7 @@
     }
 
     eeFramePtr->level = iPtr->cmdFramePtr ? iPtr->cmdFramePtr->level + 1 : 1;
+    eeFramePtr->numLevels = iPtr->numLevels;
     eeFramePtr->framePtr = iPtr->framePtr;
     eeFramePtr->nextPtr = iPtr->cmdFramePtr;
     eeFramePtr->nline = 0;
@@ -5640,6 +5641,7 @@
 	    eoFramePtr->type = TCL_LOCATION_EVAL_LIST;
 	    eoFramePtr->level = (iPtr->cmdFramePtr == NULL?
 		    1 : iPtr->cmdFramePtr->level + 1);
+	    eoFramePtr->numLevels = iPtr->numLevels;
 	    eoFramePtr->framePtr = iPtr->framePtr;
 	    eoFramePtr->nextPtr = iPtr->cmdFramePtr;
 
Index: generic/tclExecute.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclExecute.c,v
retrieving revision 1.385
diff -u -r1.385 tclExecute.c
--- generic/tclExecute.c	21 Jul 2008 19:41:42 -0000	1.385
+++ generic/tclExecute.c	22 Jul 2008 20:55:07 -0000
@@ -1867,6 +1867,7 @@
 	bcFramePtr->type = ((codePtr->flags & TCL_BYTECODE_PRECOMPILED)
 		? TCL_LOCATION_PREBC : TCL_LOCATION_BC);
 	bcFramePtr->level = (iPtr->cmdFramePtr ? iPtr->cmdFramePtr->level+1 : 1);
+	bcFramePtr->numLevels = iPtr->numLevels;
 	bcFramePtr->framePtr = iPtr->framePtr;
 	bcFramePtr->nextPtr = iPtr->cmdFramePtr;
 	bcFramePtr->nline = 0;
Index: generic/tclInt.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
retrieving revision 1.376
diff -u -r1.376 tclInt.h
--- generic/tclInt.h	21 Jul 2008 22:50:34 -0000	1.376
+++ generic/tclInt.h	22 Jul 2008 20:55:09 -0000
@@ -1094,6 +1094,8 @@
     int type;			/* Values see below. */
     int level;			/* #Frames in stack, prevent O(n) scan of
 				 * list. */
+    int numLevels;              /* value of interp's numLevels when the frame
+				 * was pushed */
     int *line;			/* Lines the words of the command start on. */
     int nline;
 
