From: SourceForge.net <no...@so...> - 2010-03-18 20:52:52
|
Bugs item #2383005, was opened at 2008-12-03 10:00 Message generated for change (Comment added) made by dgp You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2383005&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 45. Parsing and Eval Group: obsolete: 8.5.5 Status: Open Resolution: None Priority: 9 Private: No Submitted By: Don Porter (dgp) Assigned to: Alexandre Ferrieux (ferrieux) Summary: return -errorcode accepts non-list argument Initial Comment: % 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. ---------------------------------------------------------------------- >Comment By: Don Porter (dgp) Date: 2010-03-18 16:52 Message: As noted in the original report, I think the place to fix this is in TclMergeReturnOptions(), not in TclProcessReturn(). ---------------------------------------------------------------------- Comment By: Alexandre Ferrieux (ferrieux) Date: 2010-03-17 19:41 Message: 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 ? ---------------------------------------------------------------------- Comment By: Alexandre Ferrieux (ferrieux) Date: 2010-03-17 19:06 Message: 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. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2383005&group_id=10894 |