summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2006-10-05 11:38:49 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2006-10-05 11:38:49 (GMT)
commit46aff41e83607a2efd59982d1393cff759ba692e (patch)
tree93d883399106b6685342e1752f5dbdbd32ac1f6a
parentc1ba6eb6f5ed3313ca72fb73bead393e6abefb96 (diff)
downloadtcl-46aff41e83607a2efd59982d1393cff759ba692e.zip
tcl-46aff41e83607a2efd59982d1393cff759ba692e.tar.gz
tcl-46aff41e83607a2efd59982d1393cff759ba692e.tar.bz2
* generic/tclVar.c (Tcl_LappendObjCmd):
* tests/append.test(4.21-22): fix for longstanding [Bug 1570718], lappending nothing to non-list. Reported by lvirden
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclVar.c9
-rw-r--r--tests/append.test11
3 files changed, 23 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 35b947a..1ba0c01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-10-05 Miguel Sofer <msofer@users.sf.net>
+
+ * generic/tclVar.c (Tcl_LappendObjCmd):
+ * tests/append.test(4.21-22): fix for longstanding [Bug 1570718],
+ lappending nothing to non-list. Reported by lvirden
+
2006-10-04 Kevin Kenny <kennykb@acm.org>
* tzdata/: Olson's tzdata2006m.
diff --git a/generic/tclVar.c b/generic/tclVar.c
index e3daeff..0576114 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.121 2006/08/10 12:15:31 dkf Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.122 2006/10/05 11:38:50 msofer Exp $
*/
#include "tclInt.h"
@@ -2365,7 +2365,12 @@ Tcl_LappendObjCmd(
if (newValuePtr == NULL) {
return TCL_ERROR;
}
- }
+ } else {
+ result = Tcl_ListObjLength(interp, newValuePtr, &numElems);
+ if (result != TCL_OK) {
+ return result;
+ }
+ }
} else {
/*
* We have arguments to append. We used to call Tcl_SetVar2 to append
diff --git a/tests/append.test b/tests/append.test
index 58c0de7..a9772c4 100644
--- a/tests/append.test
+++ b/tests/append.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: append.test,v 1.7 2001/07/03 23:39:24 hobbs Exp $
+# RCS: @(#) $Id: append.test,v 1.8 2006/10/05 11:38:50 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -143,6 +143,15 @@ test append-4.20 {lappend command} {
catch {unset x}
lappend x(0) abc
} {abc}
+unset x
+test append-4.21 {lappend command} {
+ set x \"
+ list [catch {lappend x} msg] $msg
+} {1 {unmatched open quote in list}}
+test append-4.22 {lappend command} {
+ set x \"
+ list [catch {lappend x abc} msg] $msg
+} {1 {unmatched open quote in list}}
proc check {var size} {
set l [llength $var]