Artifacts Associated With Ticket 2865247
Ticket change [26a97aee1f] (rid 88389) by a_kovalenko on 2009-09-23 20:34:00:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Try this on CVS head: proc mumu {} { try { return -level 3 123} finally {} } catch mumu rv ro it gives 0 as result, -code 0 -level 0 as $ro and on tcl 8.6b1 it gives (rightly) 2 as result, -code 0 -level 2 as $ro The problem is caused by using TclProcessReturn in the C [try] implementation. TclProcessReturn expects -code and -level from the options to be the same as code and level passed as parameters. [try] implementation, on the other hand, passes constant 0 as level, and it may be wrong. Proposed solution is to use Tcl_SetReturnOptions instead of TclProcessReturn in [try] implementation. I think it's the best of available alternatives, because it's symmetric to Tcl_GetReturnOptions call that is used to obtain these options in the first place. Diff is attached. - foundin initialized to: "obsolete: 8.6b1"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "a_kovalenko"
- subsystem initialized to: "18. Commands M-Z"
- title initialized to: "C version of [try] assumes return -level 0"
- type initialized to: "Bug"
Ticket change [3eda7c3606] (rid 121344) by a_kovalenko on 2009-09-24 03:34:00:
- icomment:
File Added - 344088: c-version-try.diff
- login: "a_kovalenko"
- mimetype: "text/plain"
- username: "a_kovalenko"
- icomment:
Add attachment "c-version-try.diff" [84fc1a6905] (rid 131244) by a_kovalenko on 2009-09-24 03:34:00.
Ticket change [49cbfe829a] (rid 100103) by dkf on 2009-09-24 04:58:12:
- assignee changed to: "dgp"
- icomment:
I've no time to look at this at a time when I'm alert enough. Assigning to someone who might know what to do (and who knows return options well...)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
Ticket change [ab7d7d60f8] (rid 101129) by dgp on 2009-09-25 01:25:20:
- icomment:
Good catch. The comments before TclProcessReturn (hey, I wrote them for once!) give the constraints: "Note that the code argument must agree with the -code entry in returnOpts and the level argument must agree with the -level entry in returnOpts,..." Replacing with calls to Tcl_SetReturnOptions() will enforce this constraint, so the submitted patch is a correct one. Before accepting, I'll examine if there's a more direct way instead.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [2baf9eb423] (rid 118786) by dgp on 2009-09-25 02:01:16:
- icomment:
Appears to be another (potential?) error here on line 4432: result = TCL_ERROR; Since this comes between the time result is captured as the return code of the body evaluation, and the time it is passed back to TclProcessReturn(), it's at least an opportunity for the same constraint to fail. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [764524dd56] (rid 105553) by dgp on 2009-09-25 02:02:53:
- icomment:
Since preservation of the level is not provided for, and preservation of result is questionable, and since in time we expect most [try] evaluations to become bytecompiled, doesn't seem worthwhile to make revisions to permit more efficient, yet correct, calls to TclProcessReturn(). Accepting the submitted patch...
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [b760ede401] (rid 125579) by dgp on 2009-09-28 10:23:16:
- icomment:
committed tests demonstrating related, but different failures.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [6b407c9082] (rid 128290) by dgp on 2009-09-28 23:35:43:
- icomment:
* tests/error.test (error-15.9.*): More coverage tests for [try]. Test error-15.9.3.0.0 covers [Bug 2855247]. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [99fe5f4f3a] (rid 110884) by dgp on 2009-09-29 01:02:24:
- icomment:
* generic/tclCmdMZ.c: Replaced TclProcessReturn() calls with * tests/error.test: Tcl_SetReturnOptions() calls as a simple fix for [Bug 2855247]. Thanks to Anton Kovalenko for the report and fix. Additional fixes for other failures demonstrated by new tests. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [7910ef2cd7] (rid 90056) by dgp on 2009-09-29 01:02:26:
- closedate changed to: "2009-09-28T18:02:26"
- closer changed to: "dgp"
- icomment:
allow_comments - 1
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dgp"