Tcl Source Code

View Ticket
Login
Ticket UUID: 2971921
Title: Bytecode compiled try misses finally handler
Type: Bug Version: obsolete: 8.6b1.1
Submitter: cyan Created on: 2010-03-17 12:30:14
Subsystem: 18. Commands M-Z Assigned To: dkf
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2010-03-18 18:02:06
Resolution: Fixed Closed By: dkf
    Closed on: 2010-03-18 11:02:06
Description:
Tcl from CVS on 2010-03-14 on Linux (Ubuntu 9.10 x86_64)

When a bytecode compiled try command throws an error in the body, which is caught in a trap {...} handler, the finally handler is not executed.

The following script reliably reproduces the problem for me:

proc go {} {
    try {
        puts "In try body"
        throw {bar} "hello"
    } trap {bar} {res options} {
        puts "trapped bar"
    } finally {
        puts "in finally"
    }
    puts "after try"
}

go

puts "-----------------"
try {
    puts "In try body"
    throw {bar} "hello"
} trap {bar} {res options} {
    puts "trapped bar"
} finally {
    puts "in finally"
}
puts "after try"


Expected output: 

In try body
trapped bar
in finally
after try
-----------------
In try body
trapped bar
in finally
after try


Problem output:
In try body
trapped bar
after try
-----------------
In try body
trapped bar
in finally
after try


The behaviour changed with the CVS commit "Compilation of [try] now enabled!" by dkf on 2010-02-09 22:51:53.
User Comments: dkf added on 2010-03-18 18:02:06:

allow_comments - 1

dkf added on 2010-03-18 18:01:55:
Oh dear, that wasn't very nice was it? I had a jump going to the wrong place (the middle of an instruction). I'm not quite sure what it did then as it was executing immediate data, but that was clearly wrong!

Fixed now.

cyan added on 2010-03-17 19:48:50:

File Added - 367096: foo

Attachments: