|
2010-03-24
| ||
| 22:29 | • Closed ticket [2383005fff]: return -errorcode accepts non-list argument plus... artifact: e1d9715b19 user: dgp | |
|
2010-03-19
| ||
| 05:45 | • Ticket [2383005fff]: 4 changes artifact: cff4a431d9 user: ferrieux | |
| 05:44 | • Ticket [2383005fff]: 4 changes artifact: 77e0af6bf9 user: ferrieux | |
| 05:44 | • Add attachment errorcode.patch to ticket [2383005fff] artifact: 595c8b8e08 user: ferrieux | |
| 05:43 | • Ticket [2383005fff] return -errorcode accepts non-list argument status still... artifact: c6e5276b85 user: ferrieux | |
| 03:52 | • Ticket [2383005fff]: 4 changes artifact: da5205e57e user: dgp | |
|
2010-03-18
| ||
| 06:41 | • Ticket [2383005fff]: 4 changes artifact: cde50ee436 user: ferrieux | |
| 06:07 | • Ticket [2383005fff]: 4 changes artifact: 55ba8bf5b6 user: ferrieux | |
| 06:06 | • Ticket [2383005fff]: 4 changes artifact: 7892045191 user: ferrieux | |
|
2010-03-17
| ||
| 21:07 | • Ticket [2383005fff]: 2 changes artifact: b986d96322 user: dgp | |
|
2008-12-03
| ||
| 15:00 | • New ticket [2383005fff]. artifact: 313f51e793 user: dgp | |
return -errorcode accepts non-list argument
Closed / Fixed2383005fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 17 years ago
Descriptionplain2008-12-03 15:00:39
% string is list "not \{ a list"
0
% catch {return -code error -errorcode "not \{ a list"} m o
2
% set m
% set o
-errorcode not\ \{\ a\ list -code 1 -level 1
The documentation is clear in
return.n that -errorcode option
takes a list argument.
TclMergeReturnOptions() is failing to
check that.
dgp Ticket [2383005fff]: 2 changes
[History diff]2010-03-17 21:07:28
ferrieuxplain2010-03-18 06:06:45
Tiny attached patch barfs on non-list passed to [return -errorcode]. However, the exact error message is still [return]'s main argument (since it is called with -code error), because the caller of TclProcessReturn sets the interp result later. Maybe some kind of signalling should be devised to tell it about this special situation.
ferrieuxplain2010-03-18 06:07:21
File Added - 367184: return_errorcode.patch
ferrieuxplain2010-03-18 06:41:51
A simple way out would be in the non-compiled Tcl_ReturnObjCmd to exchange the two statements:
code = TclProcessReturn(interp, code, level, returnOpts);
if (explicitResult) {
Tcl_SetObjResult(interp, objv[objc-1]);
}
yielding:
if (explicitResult) {
Tcl_SetObjResult(interp, objv[objc-1]);
}
code = TclProcessReturn(interp, code, level, returnOpts);
however, doing the same in INST_RETURN_IMM in TEBC implies setting the result twice in the OK case (since the TOS ends up in the result), and I dare not (speed).
Another option, as suggested before, is to add a high bit to TCL_ERROR, that would be intercepted immediately on return from TclProcessReturn, meaning TCL_ERROR_DURING_RETURN. Ugly too.
Advice ?
dgpplain2010-03-19 03:52:52
As noted in the original report, I think the place to fix this is in TclMergeReturnOptions(), not in TclProcessReturn().
ferrieuxplain2010-03-19 05:43:57
D'oh of course :) Attaching patch, please review.
ferrieuxplain2010-03-19 05:44:50
File Added - 367318: errorcode.patch
ferrieuxplain2010-03-19 05:45:04
File Deleted - 367184:
dgpplain2010-03-24 22:29:28
allow_comments - 1 Thanks for the patch. Committing to 8.5 and HEAD changing only the SetErrorCode arguments to better match what's been done before.
Log in (anonymous is fine) to add a comment.
Attachments:
- errorcode.patch [download] added by ferrieux on 2010-03-19 05:44:50. [details]