summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--generic/tclVar.c7
-rw-r--r--tests/var.test10
3 files changed, 19 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a526096..fabb2b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,10 @@
2001-07-03 Jeff Hobbs <jeffh@ActiveState.com>
+ * tests/var.test:
+ * generic/tclVar.c (Tcl_VariableObjCmd): added patch to check for
+ number of args. [Patch #426038]
+
* generic/tclVar.c (Tcl_GetVar2Ex): added ability to recognize
TCL_TRACE_READS flags to cause creation of part1 in TclLookupVar
to make sure newly created array will get read traces triggered
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 799c5ae..ba76f00 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.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: tclVar.c,v 1.34 2001/07/03 23:38:58 hobbs Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.35 2001/07/04 00:55:08 hobbs Exp $
*/
#include "tclInt.h"
@@ -4072,6 +4072,11 @@ Tcl_VariableObjCmd(dummy, interp, objc, objv)
Tcl_Obj *varValuePtr;
int i, result;
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "?name value...? name ?value?");
+ return TCL_ERROR;
+ }
+
for (i = 1; i < objc; i = i+2) {
/*
* Look up each variable in the current namespace context, creating
diff --git a/tests/var.test b/tests/var.test
index faafd3b..cb2d093 100644
--- a/tests/var.test
+++ b/tests/var.test
@@ -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: var.test,v 1.16 2000/11/17 09:55:42 dkf Exp $
+# RCS: @(#) $Id: var.test,v 1.17 2001/07/04 00:55:08 hobbs Exp $
#
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -476,6 +476,14 @@ test var-7.15 {Tcl_VariableObjCmd, array element parameter} {
} res
set res
} "can't define \"arrayvar(1)\": name refers to an element in an array"
+test var-7.16 {Tcl_VariableObjCmd, no args} {
+ list [catch {variable} msg] $msg
+} {1 {wrong # args: should be "variable ?name value...? name ?value?"}}
+test var-7.17 {Tcl_VariableObjCmd, no args} {
+ namespace eval test_ns_var {
+ list [catch {variable} msg] $msg
+ }
+} {1 {wrong # args: should be "variable ?name value...? name ?value?"}}
test var-8.1 {TclDeleteVars, "unset" traces are called with fully-qualified var names} {
catch {namespace delete test_ns_var}