summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2019-09-06 20:22:30 (GMT)
committersebres <sebres@users.sourceforge.net>2019-09-06 20:22:30 (GMT)
commitd0f808008dd96dd8b4ba1988087dbb644ac63283 (patch)
treea64cb5bd017baed0526b8a24a160c60dcf8f68f7 /generic
parent5ed9c57d7a6452cb9bb3ae0c72953cbbf7b81c24 (diff)
downloadtcl-d0f808008dd96dd8b4ba1988087dbb644ac63283.zip
tcl-d0f808008dd96dd8b4ba1988087dbb644ac63283.tar.gz
tcl-d0f808008dd96dd8b4ba1988087dbb644ac63283.tar.bz2
if frameName (actual level) does not contain a real level (#0 or 1) historically TclGetFrame and Tcl_UpVar2 uses current level - 1, so to put supplied name in case of bad level (error at top - 1) is wrong;
be more consistent with TclObjGetFrame (at least in error case if relative level used).
Diffstat (limited to 'generic')
-rw-r--r--generic/tclProc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index f1e0148..2ee2456 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -713,17 +713,22 @@ TclGetFrame(
result = 1;
curLevel = iPtr->varFramePtr->level;
if (*name== '#') {
- if (Tcl_GetInt(interp, name+1, &level) != TCL_OK || level < 0) {
+ if (Tcl_GetInt(NULL, name+1, &level) != TCL_OK || level < 0) {
goto levelError;
}
} else if (isdigit(UCHAR(*name))) { /* INTL: digit */
- if (Tcl_GetInt(interp, name, &level) != TCL_OK) {
+ if (Tcl_GetInt(NULL, name, &level) != TCL_OK) {
goto levelError;
}
level = curLevel - level;
} else {
+ /*
+ * (historical, TODO) If name does not contain a level (#0 or 1),
+ * TclGetFrame and Tcl_UpVar2 uses current level - 1
+ */
level = curLevel - 1;
result = 0;
+ name = "1"; /* be more consistent with TclObjGetFrame (error at top - 1) */
}
/*
@@ -812,7 +817,7 @@ TclObjGetFrame(
}
level = curLevel - level;
} else if (*name == '#') {
- if (Tcl_GetInt(interp, name+1, &level) != TCL_OK || level < 0) {
+ if (Tcl_GetInt(NULL, name+1, &level) != TCL_OK || level < 0) {
goto levelError;
}