| Ticket UUID: | 77f0dbc0f8234ace6f613a37831d33fa5407ad63 | ||
| Title: | Wrong errorstack when using slave interp | ||
| Type: | Bug | Created on: | 2017-07-26 12:00:05 |
| Submitter: | danckaert | Assigned to: | nobody |
| Subsystem: | 20. [interp] | Severity: | Minor |
| Priority: | 5 Medium | Last modified: | 2017-07-31 08:58:15 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | 8.6.6 | ||
| Description: | ||||
|
When running the following code:
interp create slave
interp alias slave foo {} master_foo
proc master_foo {arg} {}
proc run_in_slave {s} {
try {
interp eval slave $s
} on error {msg options} {
puts $options
}
}
catch {error "catched error"}
run_in_slave {foo}
The output is:
-errorstack {INNER {returnImm {catched error} {}} CALL {run_in_slave foo}} -errorcode {TCL WRONGARGS} -errorinfo {wrong # args: should be "foo arg"
invoked from within
"foo"
invoked from within
"interp eval slave $s"} -errorline 3 -code 1 -level 0
The INNER part int the errorstack refers to a previous error which had already been catched and should not be present anymore. Note that -errorinfo and -errorcode are correct however.
| ||||
| User Comments: | ||||
aspect added on 2017-07-27 14:46:03:
This might come from Tcl_GetReturnOptions() not respecting resetErrorStack -
when it grabs the error stack from the master, the stale error stack gets
captured and sent into the slave.
https://core.tcl.tk/tcl/artifact/0947f3566cd3dbab?ln=1625
Replacing that line with the following seems to clear it up:
if (iPtr->resetErrorStack) {
Tcl_DictObjPut(NULL, options, keys[KEY_ERRORSTACK], Tcl_NewListObj(NULL, 0));
} else {
Tcl_DictObjPut(NULL, options, keys[KEY_ERRORSTACK], iPtr->errorStack);
}
.. but I don't understand why an alias back into the master is needed to
observe this; someone who knows better should check.
danckaert added on 2017-07-31 08:58:15:
With that change, the errorstack only contains CALL {run_in_slave foo}, but it should also contain an INNER {invokeStk1 foo} part, I think.
| ||||
