summaryrefslogtreecommitdiffstats
path: root/generic/tclEnsemble.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclEnsemble.c')
-rw-r--r--generic/tclEnsemble.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index a9bcf0c..915a916 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -277,7 +277,7 @@ TclNamespaceEnsembleCmd(
*
* Note:
* Can't use SetEnsembleConfigOptions() here. Different (but overlapping)
- * options are supported.
+ * options are supported.
*
*----------------------------------------------------------------------
*/
@@ -886,7 +886,7 @@ Tcl_CreateEnsemble(
*/
static inline EnsembleConfig *
GetEnsembleFromCommand(
- Tcl_Interp *interp, /* Where to report an error. May be NULL. */
+ Tcl_Interp *interp, /* Where to report an error. May be NULL. */
Tcl_Command token) /* What to check for ensemble-ness. */
{
Command *cmdPtr = (Command *) token;
@@ -1704,6 +1704,8 @@ TclMakeEnsemble(
TCL_AUTO_LENGTH))) {
Tcl_Panic("%s", Tcl_GetStringResult(interp));
}
+ /* don't compile unsafe subcommands in safe interp */
+ cmdPtr->compileProc = NULL;
} else {
/*
* Not hidden, so just create it. Yay!
@@ -1713,8 +1715,8 @@ TclMakeEnsemble(
Tcl_NRCreateCommand(interp, TclGetString(toObj),
map[i].proc, map[i].nreProc, map[i].clientData,
NULL);
+ cmdPtr->compileProc = map[i].compileProc;
}
- cmdPtr->compileProc = map[i].compileProc;
}
}
Tcl_SetEnsembleMappingDict(interp, ensemble, mapDict);
@@ -3222,7 +3224,7 @@ TclCompileEnsemble(
Tcl_IncrRefCount(targetCmdObj);
newCmdPtr = (Command *) Tcl_GetCommandFromObj(interp, targetCmdObj);
TclDecrRefCount(targetCmdObj);
- if (newCmdPtr == NULL || Tcl_IsSafe(interp)
+ if (newCmdPtr == NULL || (Tcl_IsSafe(interp) && !cmdPtr->compileProc)
|| newCmdPtr->nsPtr->flags & NS_SUPPRESS_COMPILATION
|| newCmdPtr->flags & CMD_HAS_EXEC_TRACES
|| ((Interp *) interp)->flags & DONT_COMPILE_CMDS_INLINE) {
@@ -3230,7 +3232,6 @@ TclCompileEnsemble(
* Maps to an undefined command or a command without a compiler.
* Cannot compile.
*/
-
goto cleanup;
}
cmdPtr = newCmdPtr;