Tcl Source Code

View Ticket
Login
Ticket UUID: 1355342
Title: cmd deletion traces do not discard the result
Type: Bug Version: obsolete: 8.5a4
Submitter: msofer Created on: 2005-11-12 17:40:56
Subsystem: 46. Traces Assigned To: dgp
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2005-11-14 23:45:20
Resolution: Fixed Closed By: dgp
    Closed on: 2005-11-14 16:45:19
Description:
% proc x {} {}
% trace add command x delete {set w aha!;#}
% rename x {}
aha!
% info patch
8.5a4

Comparing TraceCommandProc in HEAD (tclTrace.c) with
8-4-branch (tclCmdMZ.c), I see that we still have the
comment that the result is discarded, but the code is
missing: 8.4 has

   Tcl_SaveResult(interp, &state);
   stateCode = iPtr->returnCode;
   ...
   Tcl_RestoreResult(interp, &state);
   iPtr->returnCode = stateCode;

Not fixing myself as I'm not sure about the correct
fix. This code was removed on 2004-10-19 (tclTraces.c
version 1.17) when TclSaveInterpState and related were
created; the Changelog says:
"Callers of Tcl_*Result updated to call the new
routines. The calls were relocated in several cases to
perform save/restore operations only when needed."
but I do not see where this might have been relocated to.
User Comments: dgp added on 2005-11-14 23:45:20:

File Added - 156225: 1355342.patch

dgp added on 2005-11-14 23:45:19:
Logged In: YES 
user_id=80530

committing the attached patch.

dgp added on 2005-11-14 23:21:40:
Logged In: YES 
user_id=80530


The reasoning of that comment is that
there's no need for each
Tcl_CommandTraceProc and
Tcl_VarTraceProc to save/restore
the interp state is the dispatch
routine takes care of that for all.

In particular, the save/restore
in TraceCommandProc was
relocated to TclCheckExecutionTraces
and TclCheckInterpTraces

It appears the additional relocation
to CheckCommandTraces (tclBasic.c)
got overlooked?

msofer added on 2005-11-14 07:43:19:
Logged In: YES 
user_id=148712

Tests trace-20.13-16 added to HEAD

Attachments: