diff options
author | dgp <dgp@users.sourceforge.net> | 2003-10-08 23:18:35 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2003-10-08 23:18:35 (GMT) |
commit | 834dd44b02f471e7a56355d1085568f7f9a2f006 (patch) | |
tree | 40791bfcea047b6d2a6c9cf6040971fd34ba1cc9 /generic | |
parent | 69d3fa26f0b10f5a65f2c62825b453346cdcd888 (diff) | |
download | tcl-834dd44b02f471e7a56355d1085568f7f9a2f006.zip tcl-834dd44b02f471e7a56355d1085568f7f9a2f006.tar.gz tcl-834dd44b02f471e7a56355d1085568f7f9a2f006.tar.bz2 |
* generic/tclBasic.c: Save and restore the iPtr->flag bits that
control the state of errorCode and errorInfo management when calling
"leave" execution traces, so that all error information of the traced
command is still available whether traced or not. [Bug 760947]
Thanks to Yahalom Emet.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 4ef3285..d356ddf 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.90 2003/10/03 20:42:06 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.91 2003/10/08 23:18:35 dgp Exp $ */ #include "tclInt.h" @@ -3151,6 +3151,10 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags) * Call 'leave' command traces */ if (!(cmdPtr->flags & CMD_IS_DELETED)) { + int saveErrFlags = iPtr->flags + & (ERR_IN_PROGRESS | ERR_ALREADY_LOGGED | ERROR_CODE_SET); + Tcl_Obj *saveOptions = iPtr->returnOpts; + Tcl_IncrRefCount(saveOptions); if ((cmdPtr->flags & CMD_HAS_EXEC_TRACES) && (traceCode == TCL_OK)) { traceCode = TclCheckExecutionTraces (interp, command, length, cmdPtr, code, TCL_TRACE_LEAVE_EXEC, objc, objv); @@ -3159,6 +3163,13 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags) traceCode = TclCheckInterpTraces(interp, command, length, cmdPtr, code, TCL_TRACE_LEAVE_EXEC, objc, objv); } + if (traceCode == TCL_OK) { + Tcl_DecrRefCount(iPtr->returnOpts); + iPtr->returnOpts = saveOptions; + Tcl_IncrRefCount(iPtr->returnOpts); + iPtr->flags |= saveErrFlags; + } + Tcl_DecrRefCount(saveOptions); } TclCleanupCommand(cmdPtr); |