Compare commits

...
Author SHA1 Message Date
sebres 1b3cfdbb8f invocation of deleting command in trace is prohibited; test case covering "attempt to invoke a deleted command" 2020-08-11 18:14:52 +00:00
pooryorick 9277492ed1 add test namespace-58.0
TclNREvalObjv should not interrelate the TCL_EVAL_NORESOLVE and the
	CMD_IS_DEAD flags.
2020-08-11 17:27:51 +00:00
sebres c64b319080 alternatefix for [29e8848eb976], partially reverting [7eed2baf73], without new flag CMD_DEAD 2020-08-10 19:28:15 +00:00
3 changed files with 29 additions and 12 deletions
+4 -8
View File
@@ -3268,7 +3268,6 @@ Tcl_DeleteCommandFromToken(
* TclNRExecuteByteCode looks up the command in the command hashtable).
*/
cmdPtr->flags |= CMD_IS_DELETED;
TclCleanupCommandMacro(cmdPtr);
return 0;
}
@@ -4332,13 +4331,9 @@ EvalObjvCore(
* Caller gave it to us.
*/
if (!(preCmdPtr->flags & CMD_DEAD)) {
/*
* So long as it exists, use it.
*/
cmdPtr = preCmdPtr;
} else if (flags & TCL_EVAL_NORESOLVE) {
if ( (flags & TCL_EVAL_NORESOLVE)
&& (preCmdPtr->flags & CMD_IS_DELETED)
) {
/*
* When it's been deleted, and we're told not to attempt resolving
* it ourselves, all we can do is raise an error.
@@ -4349,6 +4344,7 @@ EvalObjvCore(
Tcl_SetErrorCode(interp, "TCL", "EVAL", "DELETEDCOMMAND", NULL);
return TCL_ERROR;
}
cmdPtr = preCmdPtr;
}
if (cmdPtr == NULL) {
cmdPtr = TEOV_LookupCmdFromObj(interp, objv[0], lookupNsPtr);
-1
View File
@@ -1682,7 +1682,6 @@ typedef struct Command {
#define CMD_COMPILES_EXPANDED 0x08
#define CMD_REDEF_IN_PROGRESS 0x10
#define CMD_VIA_RESOLVER 0x20
#define CMD_DEAD 0x30
/*
+25 -3
View File
@@ -3340,9 +3340,7 @@ test namespace-56.5 {Bug 8b9854c3d8} -setup {
test namespace-57.0 {
an imported alias should be usable in the deletion trace for the alias
see 29e8848eb976
an imported alias should be usable in the deletion trace for the alias, bug [29e8848eb976]
} -body {
variable res {}
namespace eval ns2 {
@@ -3379,6 +3377,30 @@ test namespace-57.0 {
} -result success
test namespace-57.1 {
invocation of deleting command in trace is prohibited, bug [29e8848eb976]
} -body {
proc p1 {} {
return success
}
proc ondelete {oldname newname args} {
variable res
interp hide {} p1
catch {
interp invokehidden {} p1
} res
}
trace add command p1 delete ondelete
rename p1 {}
return $res
} -cleanup {
catch { rename p1 {} }
unset res
} -result "attempt to invoke a deleted command"
# cleanup