diff options
author | kennykb <kennykb@noemail.net> | 2010-11-03 00:59:21 (GMT) |
---|---|---|
committer | kennykb <kennykb@noemail.net> | 2010-11-03 00:59:21 (GMT) |
commit | f94d9bc97e9d2a37e7b8fa26fe2be4242b1458ac (patch) | |
tree | bf347caee3495e42172bdd85fd2788970f07868a /tests/compile.test | |
parent | 572bd21b98158f3f6623e4a4fe7be3b640a7e36f (diff) | |
download | tcl-f94d9bc97e9d2a37e7b8fa26fe2be4242b1458ac.zip tcl-f94d9bc97e9d2a37e7b8fa26fe2be4242b1458ac.tar.gz tcl-f94d9bc97e9d2a37e7b8fa26fe2be4242b1458ac.tar.bz2 |
* generic/tclCompCmds.c (TclCompileCatchCmd):
* tests/compile.test (compile-3,6): Reworked the compilation of
the [catch] command so as to avoid placing any code that might
throw an exception (specifically, any initial substitutions
or any stores to result or options variables) between the
BEGIN_CATCH and END_CATCH but outside the exception range.
Added a test case that panics on a stack smash if the change
is not made. [Bug #3098302]
FossilOrigin-Name: 97b99f9b418edd4d329f16ed57d79ee7fdbf2009
Diffstat (limited to 'tests/compile.test')
-rw-r--r-- | tests/compile.test | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/compile.test b/tests/compile.test index d9567cc..4f4c53e 100644 --- a/tests/compile.test +++ b/tests/compile.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: compile.test,v 1.51 2009/10/29 17:21:48 dgp Exp $ +# RCS: @(#) $Id: compile.test,v 1.52 2010/11/03 00:59:22 kennykb Exp $ package require tcltest 2 namespace import -force ::tcltest::* @@ -128,6 +128,36 @@ test compile-3.5 {TclCompileCatchCmd: recover from error, [Bug 705406]} { } list [catch foo msg] $msg } {0 1} +test compile-3.6 {TclCompileCatchCmd: error in storing result [Bug 3098302]} {*}{ + -setup { + namespace eval catchtest { + variable result1 {} + } + trace add variable catchtest::result1 write catchtest::failtrace + proc catchtest::failtrace {n1 n2 op} { + return -code error "trace on $n1 fails by request" + } + } + -body { + proc catchtest::x {} { + variable result1 + set count 0 + for {set i 0} {$i < 10} {incr i} { + set status2 [catch { + set status1 [catch { + return -code error -level 0 "original failure" + } result1 options1] + } result2 options2] + incr count + } + list $count $result2 + } + catchtest::x + } + -result {10 {can't set "result1": trace on result1 fails by request}} + -cleanup {namespace delete catchtest} +} + test compile-4.1 {TclCompileForCmd: command substituted test expression} { set i 0 |