summaryrefslogtreecommitdiffstats
path: root/generic/tclNamesp.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2006-08-26 13:00:38 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2006-08-26 13:00:38 (GMT)
commit8d05e9798827f58abf7ac5d5d28d2b03ede92daa (patch)
tree3df61a5d622e226e99dba583252d97dab5356aea /generic/tclNamesp.c
parentccfa5605f3ee0ddba99ef360e7c3bc5414558987 (diff)
downloadtcl-8d05e9798827f58abf7ac5d5d28d2b03ede92daa.zip
tcl-8d05e9798827f58abf7ac5d5d28d2b03ede92daa.tar.gz
tcl-8d05e9798827f58abf7ac5d5d28d2b03ede92daa.tar.bz2
bugfix, docs clarification and new tests for 'namespace upvar' [Bug 1546833]
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r--generic/tclNamesp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 15ed318..89f1618 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -22,7 +22,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclNamesp.c,v 1.97 2006/08/11 15:16:21 dkf Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.98 2006/08/26 13:00:39 msofer Exp $
*/
#include "tclInt.h"
@@ -4600,6 +4600,18 @@ NamespaceUpvarCmd(
if (result != TCL_OK) {
return TCL_ERROR;
}
+ if (nsPtr == NULL) {
+ /*
+ * The namespace does not exist, leave an error message.
+ */
+
+ Tcl_Obj *resPtr;
+
+ TclNewObj(resPtr);
+ TclFormatObj(NULL, resPtr, "namespace \"%s\" does not exist", objv[2]);
+ Tcl_SetObjResult(interp, resPtr);
+ return TCL_ERROR;
+ }
objc -= 3;
objv += 3;
@@ -4613,10 +4625,10 @@ NamespaceUpvarCmd(
otherPtr = TclObjLookupVar(interp, objv[0], NULL,
(TCL_NAMESPACE_ONLY | TCL_LEAVE_ERR_MSG), "access",
/*createPart1*/ 1, /*createPart2*/ 1, &arrayPtr);
+ Tcl_PopCallFrame(interp);
if (otherPtr == NULL) {
return TCL_ERROR;
}
- Tcl_PopCallFrame(interp);
/*
* Create the new variable and link it to otherPtr