Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 26a97aee1fab9feac27c2f6e908e1b6f22473569
Ticket: 2865247fffffffffffffffffffffffffffffffff
C version of [try] assumes return -level 0
User & Date: a_kovalenko on 2009-09-23 20:34:00
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Try this on CVS head:
    proc mumu {} { try { return -level 3 123} finally {} }
    catch mumu rv ro
    it gives 0 as result, -code 0 -level 0 as $ro
    and on tcl 8.6b1 it gives (rightly)
    2 as result, -code 0 -level 2 as $ro
    
    The problem is caused by using TclProcessReturn in the C [try] implementation. TclProcessReturn expects -code and -level from the options to be the same as code and level passed as parameters. [try] implementation, on the other hand, passes constant 0 as level, and it may be wrong.
    
    Proposed solution is to use Tcl_SetReturnOptions instead of TclProcessReturn in [try] implementation. I think it's the best of available alternatives, because it's symmetric to Tcl_GetReturnOptions call that is used to obtain these options in the first place.
    
    Diff is attached.
    
  4. foundin changed to: "obsolete: 8.6b1"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "a_kovalenko"
  10. subsystem changed to: "18. Commands M-Z"
  11. title changed to: "C version of [try] assumes return -level 0"
  12. type changed to: "Bug"