diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2004-05-23 22:53:18 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2004-05-23 22:53:18 (GMT) |
commit | f606211e0c51995aea56b201d27556a45c10109c (patch) | |
tree | ced351781e4a4d76a53b7dd645aabb4c988d1e6d /generic/tclVar.c | |
parent | 0463c49be94c19a4a433c4657f8e565e80e1b0b3 (diff) | |
download | tcl-f606211e0c51995aea56b201d27556a45c10109c.zip tcl-f606211e0c51995aea56b201d27556a45c10109c.tar.gz tcl-f606211e0c51995aea56b201d27556a45c10109c.tar.bz2 |
* generic/tclNamesp.c (Tcl_FindNamespaceVar): [Bug 959052] fixed,
insuring that no "zombie" variables are found.
* generic/tclVar.c (TclLookupSimpleVar): comments re [Bug 736729]
(predecessor of [Bug 959052]) removed.
* tests/namespace.test: added tests 17.10-12
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r-- | generic/tclVar.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c index 9097fd1..e84ce8f 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.81 2004/05/22 16:21:17 msofer Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.82 2004/05/23 22:53:20 msofer Exp $ */ #include "tclInt.h" @@ -758,30 +758,18 @@ TclLookupSimpleVar(interp, varName, flags, create, errMsgPtr, indexPtr) } } - /* - * FIXME: [Bug 736729] - * - * When a varName is looked from a namespace different from the - * global one, there is no corresponding variable in the namespace and - * there is a "zombie" variable in the global namespace (ie, the - * varName is in the hash table, but the variable is unset), this code - * returns a reference to the zombie. It should instead create a - * variable in the namespace. - * - * Fix in progress - that it is not here yet may indicate that the - * picture above is incomplete or wrong. - * - Miguel Sofer, 2004-05-22 - */ - /* * Don't pass TCL_LEAVE_ERR_MSG, we may yet create the variable, * or otherwise generate our own error! */ + var = Tcl_FindNamespaceVar(interp, varName, (Tcl_Namespace *) cxtNsPtr, flags & ~TCL_LEAVE_ERR_MSG); + if (var != (Tcl_Var) NULL) { varPtr = (Var *) var; } + if (varPtr == NULL) { if (create) { /* var wasn't found so create it */ TclGetNamespaceForQualName(interp, varName, cxtNsPtr, @@ -799,7 +787,7 @@ TclLookupSimpleVar(interp, varName, flags, create, errMsgPtr, indexPtr) Tcl_SetHashValue(hPtr, varPtr); varPtr->hPtr = hPtr; varPtr->nsPtr = varNsPtr; - if ((lookGlobal) || (varNsPtr == NULL)) { + if (lookGlobal) { /* * The variable was created starting from the global * namespace: a global reference is returned even if |