summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclExecute.c7
-rw-r--r--tests/dict.test8
3 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 40fcd76..86efb0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-12-15 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tclExecute.c (TEBC:INST_DICT_GET): Make sure that the result
+ is empty when generating an error message. [Bug 2431847]
+
2008-12-15 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
* generic/tclBinary.c: Fix [Bug 2380293]. Redefine non-strict
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index d1ff368..9fc6dc8 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.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: tclExecute.c,v 1.419 2008/10/26 18:34:04 dkf Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.420 2008/12/15 23:09:24 dkf Exp $
*/
#include "tclInt.h"
@@ -7085,7 +7085,10 @@ TclExecuteByteCode(
"%u => ERROR reading leaf dictionary key \"%s\": ",
opnd, O2S(dictPtr)), Tcl_GetObjResult(interp));
} else {
- /*Tcl_ResetResult(interp);*/
+ Tcl_Obj *tmpObj;
+
+ TclNewObj(tmpObj);
+ Tcl_SetObjResult(interp, tmpObj);
Tcl_AppendResult(interp, "key \"", TclGetString(OBJ_AT_TOS),
"\" not known in dictionary", NULL);
TRACE_WITH_OBJ(("%u => ERROR ", opnd), Tcl_GetObjResult(interp));
diff --git a/tests/dict.test b/tests/dict.test
index c631cdc..b83a5ed 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.31 2008/12/10 11:15:05 dkf Exp $
+# RCS: @(#) $Id: dict.test,v 1.32 2008/12/15 23:09:24 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -113,6 +113,12 @@ test dict-3.13 {dict get command} {
test dict-3.14 {dict get command} -returnCodes error -body {
dict get {a b c d} a c
} -result {missing value to go with key}
+test dict-3.15 {compiled dict get error cleanliness - Bug 2431847} -body {
+ apply {{} {
+ dict set a(z) b c
+ dict get $a(z) d
+ }}
+} -returnCodes error -result {key "d" not known in dictionary}
test dict-4.1 {dict replace command} {
getOrder [dict replace {a b c d}] a c