Attachment "None" to
ticket [403530ffff]
added by
dgp
2001-02-01 02:10:58.
? package.patch
? solaris
? ncode.patch
? unix/httpd
Index: generic/tclNamesp.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclNamesp.c,v
retrieving revision 1.18
diff -u -r1.18 tclNamesp.c
--- generic/tclNamesp.c 2000/05/11 00:17:29 1.18
+++ generic/tclNamesp.c 2001/01/31 19:10:13
@@ -2639,10 +2639,10 @@
* Here "arg" can be a list. "namespace code arg" produces a result
* equivalent to that produced by the command
*
- * list namespace inscope [namespace current] $arg
+ * list ::namespace inscope [namespace current] $arg
*
* However, if "arg" is itself a scoped value starting with
- * "namespace inscope", then the result is just "arg".
+ * "::namespace inscope", then the result is just "arg".
*
* Results:
* Returns TCL_OK if successful, and TCL_ERROR if anything goes wrong.
@@ -2676,6 +2676,10 @@
*/
arg = Tcl_GetStringFromObj(objv[2], &length);
+ while (*arg == ':') {
+ arg++;
+ length--;
+ }
if ((*arg == 'n') && (length > 17)
&& (strncmp(arg, "namespace", 9) == 0)) {
for (p = (arg + 9); (*p == ' '); p++) {
@@ -2698,7 +2702,7 @@
listPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
Tcl_ListObjAppendElement(interp, listPtr,
- Tcl_NewStringObj("namespace", -1));
+ Tcl_NewStringObj("::namespace", -1));
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj("inscope", -1));
Index: library/init.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/init.tcl,v
retrieving revision 1.44
diff -u -r1.44 init.tcl
--- library/init.tcl 2000/12/11 04:17:38 1.44
+++ library/init.tcl 2001/01/31 19:10:14
@@ -163,7 +163,7 @@
# then concatenate its arguments onto the end and evaluate it.
set cmd [lindex $args 0]
- if {[regexp "^namespace\[ \t\n\]+inscope" $cmd] && [llength $cmd] == 4} {
+ if {[regexp "^:*namespace\[ \t\n\]+inscope" $cmd] && [llength $cmd] == 4} {
set arglist [lrange $args 1 end]
set ret [catch {uplevel 1 ::$cmd $arglist} result]
if {$ret == 0} {
Index: tests/namespace-old.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/namespace-old.test,v
retrieving revision 1.5
diff -u -r1.5 namespace-old.test
--- tests/namespace-old.test 2000/04/10 17:19:02 1.5
+++ tests/namespace-old.test 2001/01/31 19:10:14
@@ -804,17 +804,17 @@
namespace eval test_ns_inscope {
namespace code {"1 2 3" "4 5" 6}
}
-} {namespace inscope ::test_ns_inscope {"1 2 3" "4 5" 6}}
+} {::namespace inscope ::test_ns_inscope {"1 2 3" "4 5" 6}}
test namespace-old-10.5 {with one arg, first "scope" sticks} {
set sval [namespace eval test_ns_inscope {namespace code {one two}}]
namespace code $sval
-} {namespace inscope ::test_ns_inscope {one two}}
+} {::namespace inscope ::test_ns_inscope {one two}}
test namespace-old-10.6 {with many args, each "scope" adds new args} {
set sval [namespace eval test_ns_inscope {namespace code {one two}}]
namespace code "$sval three"
-} {namespace inscope ::test_ns_inscope {one two} three}
+} {::namespace inscope ::test_ns_inscope {one two} three}
test namespace-old-10.7 {scoped commands work with eval} {
set cref [namespace eval test_ns_inscope {namespace code show}]
Index: tests/namespace.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/namespace.test,v
retrieving revision 1.13
diff -u -r1.13 namespace.test
--- tests/namespace.test 2000/05/11 00:17:29 1.13
+++ tests/namespace.test 2001/01/31 19:10:14
@@ -694,12 +694,23 @@
} {namespace inscope ::test_ns_1 cmd}
test namespace-22.4 {NamespaceCodeCmd, in :: namespace} {
namespace code unknown
-} {namespace inscope :: unknown}
+} {::namespace inscope :: unknown}
test namespace-22.5 {NamespaceCodeCmd, in other namespace} {
namespace eval test_ns_1 {
namespace code cmd
}
-} {namespace inscope ::test_ns_1 cmd}
+} {::namespace inscope ::test_ns_1 cmd}
+test namespace-22.6 {NamespaceCodeCmd, in other namespace} {
+ namespace eval test_ns_1 {
+ variable v 42
+ }
+ namespace eval test_ns_2 {
+ proc namespace args {}
+ }
+ namespace eval test_ns_2 [namespace eval test_ns_1 {
+ namespace code {set v}
+ }]
+} {42}
test namespace-23.1 {NamespaceCurrentCmd, bad args} {
catch {eval namespace delete [namespace children :: test_ns_*]}