diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-10-19 22:20:01 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-10-19 22:20:01 (GMT) |
commit | 21f353c929064a6f5b7ab0395307b808ca9eef3f (patch) | |
tree | bcfeefd5cdcf54cb1602bf07647bb31e4126fd6b | |
parent | 279edeb409045869695bb787e0e586cf8d1a62b2 (diff) | |
download | tcl-21f353c929064a6f5b7ab0395307b808ca9eef3f.zip tcl-21f353c929064a6f5b7ab0395307b808ca9eef3f.tar.gz tcl-21f353c929064a6f5b7ab0395307b808ca9eef3f.tar.bz2 |
Stop losing result codes in [dict with] in some circumstances
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclDictObj.c | 5 | ||||
-rw-r--r-- | tests/dict.test | 14 |
3 files changed, 20 insertions, 4 deletions
@@ -1,3 +1,8 @@ +2004-10-19 Donal K. Fellows <donal.k.fellows@man.ac.uk> + + * generic/tclDictObj.c (DictWithCmd): Make sure all paths (that + are not themselves error paths) do not lose the result code. + 2004-10-19 Don Porter <dgp@users.sourceforge.net> * generic/tclInt.h (Tcl*InterpState): New internal routines diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 6d99243..57576e4 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.25 2004/10/19 21:54:06 dgp Exp $ + * RCS: @(#) $Id: tclDictObj.c,v 1.26 2004/10/19 22:20:04 dkf Exp $ */ #include "tclInt.h" @@ -2975,8 +2975,7 @@ DictWithCmd(interp, objc, objv) if (allocdict) { TclDecrRefCount(dictPtr); } - TclRestoreInterpState(interp, state); - return TCL_OK; + return TclRestoreInterpState(interp, state); } } else { leafPtr = dictPtr; diff --git a/tests/dict.test b/tests/dict.test index c1004eb..f6c11d7 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.11 2004/10/08 22:44:49 dkf Exp $ +# RCS: @(#) $Id: dict.test,v 1.12 2004/10/19 22:20:05 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -1025,6 +1025,18 @@ test dict-22.9 {dict with command} { } set a } {b {c dd}} +test dict-22.10 {dict with command: result handling tricky case} { + set a {b {c d}} + foreach i {0 1} { + if {$i} break + dict with a b { + set a {} + # We're checking to see if we lose this break + break + } + } + list $i $a +} {0 {}} # cleanup ::tcltest::cleanupTests |