summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2010-05-19 21:47:48 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2010-05-19 21:47:48 (GMT)
commit7e4239c1ba238f258459935867402e007325bc32 (patch)
treecbf09fc66c588b10af9bf71a9241ab17bdb5176f
parentce9483a5bd1885e47f7f2ab67a2c947736fd7c3d (diff)
downloadtcl-7e4239c1ba238f258459935867402e007325bc32.zip
tcl-7e4239c1ba238f258459935867402e007325bc32.tar.gz
tcl-7e4239c1ba238f258459935867402e007325bc32.tar.bz2
Backport of fix for [Bug 3004007], EIAS violation in list-dict conversions.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclDictObj.c10
-rw-r--r--tests/dict.test3
3 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a1df7d3..be38c82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-19 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+
+ * generic/tclDictObj.c: Backport of fix for [Bug 3004007], EIAS
+ * tests/dict.test: violation in list-dict conversions.
+
2010-05-07 Andreas Kupries <andreask@activestate.com>
* library/platform/platform.tcl: Fix cpu name for Solaris/Intel 64bit.
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index d66a9b7..bf10967 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclDictObj.c,v 1.56.2.3 2009/10/08 14:42:40 dkf Exp $
+ * RCS: @(#) $Id: tclDictObj.c,v 1.56.2.4 2010/05/19 21:47:49 ferrieux Exp $
*/
#include "tclInt.h"
@@ -602,6 +602,14 @@ SetDictFromAny(
if (!isNew) {
Tcl_Obj *discardedValue = Tcl_GetHashValue(hPtr);
+ /*
+ * Not really a well-formed dictionary as there are duplicate
+ * keys, so better get the string rep here so that we can
+ * convert back.
+ */
+
+ (void) Tcl_GetString(objPtr);
+
TclDecrRefCount(discardedValue);
}
Tcl_SetHashValue(hPtr, objv[i+1]);
diff --git a/tests/dict.test b/tests/dict.test
index 2d15909..f7996df 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: dict.test,v 1.24.2.3 2009/10/08 14:42:40 dkf Exp $
+# RCS: @(#) $Id: dict.test,v 1.24.2.4 2010/05/19 21:47:49 ferrieux Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -130,6 +130,7 @@ test dict-3.15 {compiled dict get error cleanliness - Bug 2431847} -body {
dict get $a(z) d
}}
} -returnCodes error -result {key "d" not known in dictionary}
+test dict-3.16 {dict/list shimmering - Bug 3004007} {set l [list p 1 p 2 q 3];dict get $l q;set l} {p 1 p 2 q 3}
test dict-4.1 {dict replace command} {
getOrder [dict replace {a b c d}] a c