summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r--generic/tclProc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 17635e7..9677f02 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -2457,6 +2457,14 @@ SetLambdaFromAny(
argsPtr = objv[0];
bodyPtr = objv[1];
+ /*
+ * Bugfix for testapplylambda. If we are constructing a new lambda,
+ * the body must be recompiled even if it is already a ByteCode object.
+ * Otherwise the procPtr->numCompiledLocals will not get updated causing
+ * a crash as local variable space is not allocated.
+ */
+ (void) TclGetString(bodyPtr); /* Ensure string representation exists */
+ TclFreeInternalRep(bodyPtr);
/*
* Create and initialize the Proc struct. The cmdPtr field is set to NULL