diff options
author | Kevin B Kenny <kennykb@acm.org> | 2010-11-03 00:59:22 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2010-11-03 00:59:22 (GMT) |
commit | 4ac4e5c0f9920027f560c0c6234a8249f8724ec5 (patch) | |
tree | bf347caee3495e42172bdd85fd2788970f07868a /tests | |
parent | 03556d3d486b03faccfd612eaaecce57f204a66e (diff) | |
download | tcl-4ac4e5c0f9920027f560c0c6234a8249f8724ec5.zip tcl-4ac4e5c0f9920027f560c0c6234a8249f8724ec5.tar.gz tcl-4ac4e5c0f9920027f560c0c6234a8249f8724ec5.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]
Diffstat (limited to 'tests')
-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 |