TclUpdateReturnInfo() panics when returning TCL_RETURN
Closed / Fixed1209759fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2005-05-27 10:56:33
Have a command, say "ret", which returns the code
TCL_RETURN, for example as a proc:
proc ret {} { return -code 2 }
... and a procedure which calls "ret":
Then, running tclsh you get:
% catch ret
% 2
% ret
% foo
But, if you implement the "ret" command in C, for example,
static int
ret_cmd( ClientData, Tcl_Interp * interp, int, Tcl_Obj
* const * )
{
return TCL_RETURN;
}
you'll get tclsh oborting:
% load libret.so ;# creates the "ret" command
% proc foo {} { ret }
% catch ret
% 2
% foo
TclUpdateReturnInfo: negative return level
dkf Ticket [1209759fff]: 2 changes
[History diff]2005-05-27 19:36:58
dgpplain2005-06-02 03:33:38
Logged In: YES user_id=80530 Can't reproduce this with the current development sources. Believe this is already fixed for Tcl 8.5a3.
dgpplain2005-06-02 03:50:17
Logged In: YES user_id=80530 ok, not sure what error I made before, but I reproduce it now.
dgpplain2005-06-02 04:38:37
Logged In: YES
user_id=80530
ok, for compatibility with earlier
Tcl releases, we want
return TCL_RETURN;
to mean the same as
return Tcl_SetReturnOptions(interp, Tcl_NewObj());
Committing simple fix to achieve that.
dgpplain2005-06-02 05:19:23
Logged In: YES user_id=80530 revised fix committed that should be more efficient.
dgp Ticket [1209759fff]: 2 changes
[History diff]2005-06-02 05:19:24
Log in (anonymous is fine) to add a comment.