• Tcl_TraceVar() and Tcl_Save/RestoreInterpState()

    From Ralf Fassel@21:1/5 to All on Tue Nov 29 17:22:01 2022
    The manpage for Tcl_TraceVar() states

    RESTRICTIONS
    A trace procedure can be called at any time, even when there are par-
    tially formed results stored in the interpreter. If the trace proce-
    dure does anything that could damage this result (such as calling
    Tcl_Eval) then it must use the Tcl_SaveInterpState and related routines
    to save and restore the original state of the interpreter before it re-
    turns.

    Does

    Tcl_GetVar2(interp, "p1", "p2", TCL_LEAVE_ERR_MSG)

    in the trace procedure also count as "possible damage to the interp
    result"?

    I suspect as much, since if the variable is not found, "an error message
    is left in interp's result if the TCL_LEAVE_ERR_MSG flag bit is set."

    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)