Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7279c649f3fd2d7d3e0fde04306639f42562fa10
Ticket: 402501ffffffffffffffffffffffffffffffffff
Fix for Bug 119393 ([trace remove] & Tcl_Preserve)
User & Date: dgp on 2001-02-28 06:05:18
Changes

  1. icomment:
    Logged In: YES 
    user_id=80530
    
    The fix I had in mind for this has two steps.
    
    1. Modify CallTraces() (in generic/tclVar.c) so that it
    can recognize a special value
    
    #define TCL_TRACE_ERROR_MESSAGE_IN_INTERP_RESULT 0x1
    
    returned from a trace procedure as a signal that the error
    message should be retrieved from
    Tcl_GetStringResult(interp).
    
    That change would require a TIP.
    
    2. Make use of the new interface by having TraceVarInfo()
    stick error messages in the interp result and return
    TCL_TRACE_ERROR_MESSAGE_IN_INTERP_RESULT when there is
    an error in the evaluation of the trace script.  Then
    get rid of the errMsg field in the TraceVarInfo struct.
    
    This seems to me to be the safe way to get an error message
    that is not a static string back to Tcl_TraceVar().
    Similar changes/fixes may also be needed in
    CallCommandTraces(), etc.
    
    This approach may go against the RESTRICTIONS section of
    Tcl_TraceVar(3), though.  That section instructs all trace
    procedures to save and restore interp->result before 
    returning.  But why impose that burden on every trace
    procedure?  Why isn't CallTraces() itself saving and
    restoring the interpreter result?
    
    
  2. login: "dgp"
  3. mimetype: "text/plain"
  4. username: "dgp"