summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdAH.c
diff options
context:
space:
mode:
authormsofer <msofer@noemail.net>2009-03-21 09:42:06 (GMT)
committermsofer <msofer@noemail.net>2009-03-21 09:42:06 (GMT)
commit1635716dd679eaa880af6366961f3426fce67890 (patch)
treee8e1c28643010bdcc4334464e09bcae493800483 /generic/tclCmdAH.c
parent0d0649efc5a8f4d1bf7bfa1df8b4a01ac7d4253e (diff)
downloadtcl-1635716dd679eaa880af6366961f3426fce67890.zip
tcl-1635716dd679eaa880af6366961f3426fce67890.tar.gz
tcl-1635716dd679eaa880af6366961f3426fce67890.tar.bz2
* generic/tclBasic.c: Fix for (among others) [Bug 2699087]
* generic/tclCmdAH.c: Tailcalls now perform properly even from * generic/tclExecute.c: within [eval]ed scripts. * generic/tclInt.h: More tests missing, as well as proper exploration and testing of the interaction with "redirectors" like interp-alias (suspect that it does not happen in constant space) and pure-eval commands. FossilOrigin-Name: 8145ecc0e68b9f057214c880686a78b20c727c73
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r--generic/tclCmdAH.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index c8829f8..a00fff8 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdAH.c,v 1.115 2009/02/03 23:34:33 nijtmans Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.116 2009/03/21 09:42:06 msofer Exp $
*/
#include "tclInt.h"
@@ -302,12 +302,26 @@ CatchObjCmdCallback(
Tcl_Interp *interp,
int result)
{
+ Interp *iPtr = (Interp *) interp;
int objc = PTR2INT(data[0]);
Tcl_Obj *varNamePtr = data[1];
Tcl_Obj *optionVarNamePtr = data[2];
int rewind = ((Interp *) interp)->execEnvPtr->rewind;
/*
+ * catch has to disable any tailcall
+ */
+
+ if (iPtr->varFramePtr->tailcallPtr) {
+ TclClearTailcall(interp, iPtr->varFramePtr->tailcallPtr);
+ iPtr->varFramePtr->tailcallPtr = NULL;
+ result = TCL_ERROR;
+ Tcl_SetResult(interp,"Tailcall called from within a catch environment",
+ TCL_STATIC);
+ }
+
+
+ /*
* We disable catch in interpreters where the limit has been exceeded.
*/