summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--doc/namespace.n6
-rw-r--r--generic/tclNamesp.c6
-rw-r--r--tests/upvar.test15
4 files changed, 24 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a033663..1fca8c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
TIP #323 IMPLEMENTATION (partial)
+ * doc/namespace.n: Revise [namespace upvar] to accept zero
+ * generic/tclNamesp.c: variable names.
+ * tests/upvar.test:
+
* doc/lassign.n: Revise [lassign] to accept zero variable names.
* generic/tclCmdIL.c:
* tests/cmdIL.test:
diff --git a/doc/namespace.n b/doc/namespace.n
index 0450659..f2bc686 100644
--- a/doc/namespace.n
+++ b/doc/namespace.n
@@ -7,7 +7,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.n,v 1.32 2008/09/07 14:01:54 msofer Exp $
+'\" RCS: @(#) $Id: namespace.n,v 1.33 2008/09/26 19:36:50 dgp Exp $
'\"
.so man.macros
.TH namespace n 8.5 Tcl "Tcl Built-In Commands"
@@ -278,9 +278,9 @@ This command is the complement of the \fBnamespace qualifiers\fR command.
It does not check whether the namespace names are, in fact,
the names of currently defined namespaces.
.TP
-\fBnamespace upvar\fR \fInamespace\fR \fIotherVar myVar \fR?\fIotherVar myVar \fR...
+\fBnamespace upvar\fR \fInamespace\fR ?\fIotherVar myVar \fR...
.
-This command arranges for one or more local variables in the current
+This command arranges for zero or more local variables in the current
procedure to refer to variables in \fInamespace\fR. The namespace name is
resolved as described in section \fBNAME RESOLUTION\fR.
The command
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 55f9200..e08ab4e 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -23,7 +23,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.176 2008/08/23 11:35:54 dkf Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.177 2008/09/26 19:36:50 dgp Exp $
*/
#include "tclInt.h"
@@ -4495,9 +4495,9 @@ NamespaceUpvarCmd(
Var *otherPtr, *arrayPtr;
char *myName;
- if (objc < 5 || !(objc & 1)) {
+ if (objc < 3 || !(objc & 1)) {
Tcl_WrongNumArgs(interp, 2, objv,
- "ns otherVar myVar ?otherVar myVar ...?");
+ "ns ?otherVar myVar ...?");
return TCL_ERROR;
}
diff --git a/tests/upvar.test b/tests/upvar.test
index bcad004..d774626 100644
--- a/tests/upvar.test
+++ b/tests/upvar.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: upvar.test,v 1.16 2007/12/13 15:26:07 dgp Exp $
+# RCS: @(#) $Id: upvar.test,v 1.17 2008/09/26 19:36:51 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -544,6 +544,19 @@ test upvar-NS-1.9 {nsupvar links to correct variable} \
-returnCodes error \
-cleanup {namespace delete test_ns_1}
+test upvar-NS-2.1 {TIP 323} -returnCodes error -body {
+ namespace upvar
+} -result {wrong # args: should be "namespace upvar ns ?otherVar myVar ...?"}
+
+test upvar-NS-2.1 {TIP 323} -setup {
+ namespace eval test_ns_1 {}
+} -body {
+ namespace upvar test_ns_1
+} -cleanup {
+ namespace delete test_ns_1
+} -result {}
+
+
# cleanup
::tcltest::cleanupTests