From be1d3ffdb010f8ac70bfb807fca3631897628951 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Thu, 3 May 2001 21:14:57 +0000 Subject: Patch for bug #420507 --- ChangeLog | 8 ++++++++ generic/tclParse.c | 4 ++-- tests/namespace.test | 13 ++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 32788cb..2fb859f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-05-03 Miguel Sofer + + * generic/tclParse.c: + * tests/namespace.test: Insure consistent behaviour of the + [unknown] command: when a command is unknown, it is always + processed by [::unknown], ignoring any namespace proc which + happens to be called "unknown" [Patch #421166, Bug #420507] + 2001-05-02 Don Porter * tools/genStubs.tcl: Add a package require of Tcl 8 diff --git a/generic/tclParse.c b/generic/tclParse.c index 96678ef..de62df8 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclParse.c,v 1.14 2000/11/01 22:13:39 hobbs Exp $ + * RCS: @(#) $Id: tclParse.c,v 1.15 2001/05/03 21:14:57 msofer Exp $ */ #include "tclInt.h" @@ -860,7 +860,7 @@ EvalObjv(interp, objc, objv, command, length, flags) for (i = objc-1; i >= 0; i--) { newObjv[i+1] = objv[i]; } - newObjv[0] = Tcl_NewStringObj("unknown", -1); + newObjv[0] = Tcl_NewStringObj("::unknown", -1); Tcl_IncrRefCount(newObjv[0]); cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, newObjv[0]); if (cmdPtr == NULL) { diff --git a/tests/namespace.test b/tests/namespace.test index 234f90b..75f8fc5 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: namespace.test,v 1.14 2001/04/07 02:12:30 msofer Exp $ +# RCS: @(#) $Id: namespace.test,v 1.15 2001/05/03 21:14:57 msofer Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -1125,6 +1125,17 @@ test namespace-39.3 {NamespaceExistsCmd error} { list [catch {namespace exists a b} msg] $msg } {1 {wrong # args: should be "namespace exists name"}} +test namespace-40.1 {Ignoring namespace proc "unknown"} { + rename unknown _unknown + proc unknown args {return global} + namespace eval ns {proc unknown args {return local}} + set l [list [namespace eval ns aaa bbb] [namespace eval ns aaa]] + rename unknown {} + rename _unknown unknown + namespace delete ns + set l +} {global global} + # cleanup catch {rename cmd1 {}} catch {unset l} -- cgit v0.12