cmd deletion traces do not discard the result
Closed / Fixed1355342fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-11-12 17:40:56
% 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.
msoferplain2005-11-14 07:43:19
Logged In: YES user_id=148712 Tests trace-20.13-16 added to HEAD
dgpplain2005-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?
dgpplain2005-11-14 23:45:19
Logged In: YES user_id=80530 committing the attached patch.
dgpplain2005-11-14 23:45:20
File Added - 156225: 1355342.patch
Log in (anonymous is fine) to add a comment.
Attachments:
- 1355342.patch [download] added by dgp on 2005-11-14 23:45:20. [details]