Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-08-28
18:31 • Closed ticket [219384ffff]: inconsistent return at level #0 plus 7 other c... artifact: 19fc3137fc user: msofer
2001-08-25
07:01 • Ticket [219384ffff]: 4 changes artifact: 0c5a5166cb user: msofer
2001-04-05
22:48 • Ticket [219384ffff]: 1 change artifact: 9fc2ccad67 user: msofer
08:04 • Ticket [219384ffff]: 1 change artifact: 6488a5f163 user: dgp
2000-11-15
21:51 • Ticket [219384ffff]: 1 change artifact: cfd2c2a26c user: dkf
2000-10-26
05:12 • New ticket [219384ffff]. artifact: 442ac98c94 user: nobody

inconsistent [return] at level #0

Closed / Duplicate219384ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 25 years ago
Descriptionplain2000-10-26 05:12:05
OriginalBugID: 6103 Bug
Version: 8.3.1
SubmitDate: '2000-08-09'
LastModified: '2000-10-25'
Severity: SER
Status: UnAssn
Submitter: techsupp
OS: All
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:
Don Porter

Comments:
The source of the problem is in tclParse.c,
    in the routine Tcl_EvalTokens():
    
                case TCL_TOKEN_COMMAND:
                    code = Tcl_EvalEx(interp, tokenPtr->start+1,
    tokenPtr->size+2,
                            0);
                    if (code != TCL_OK) {
                       goto error;
                    }
    
    This code effectively converts all non-TCL_OK return codes
    into a TCL_ERROR return code, which is not correct.  I don't
    see an immediate fix, though, since Tcl_EvalTokens() returns
    a Tcl_Obj, not a Tcl return code.  There doesn't seem to be
    any channel for passing back the return code to the caller.
    
    This same problem is the cause of bug report #2136, and it
    may be related to other bug reports linked to #2136.
    
    BTW, the status of ticket #2136 is "Assigned".  Any way
    to find out to whom it was assigned?

ReproducibleScript:
$ cat demo1.tcl
# FILE: demo1.tcl
puts [info patchlevel]
return

$ cat demo2.tcl
# FILE: demo1.tcl
puts [info patchlevel]
list [return]

ObservedBehavior:
$ tclsh8.0 demo1.tcl
8.0.5

$ tclsh8.0 demo2.tcl
8.0.5

$ tclsh demo1.tcl
8.3.1

$ tclsh demo2.tcl
8.3.1
 
    while executing
"list [return]
"
    (file "demo2.tcl" line 3)

DesiredBehavior:
I expect the [return] command at level #0 of
evaluation to behave the same whether it is 
invoked directly, or as part of a command
substitution.  Tcl 8.0.5 gets it right.
Tcl 8.1.0 and every Tcl since gets it wrong,
as demonstrated above using Tcl 8.3.1.
dkf Ticket [219384ffff]: 1 change [History diff]2000-11-15 21:51:51
dgp Ticket [219384ffff]: 1 change [History diff]2001-04-05 08:04:33
msofer Ticket [219384ffff]: 1 change [History diff]2001-04-05 22:48:17
msoferplain2001-08-25 07:01:17
Logged In: YES 
user_id=148712

Seems to be fixed by the patch to bug #455151
msoferplain2001-08-28 18:31:06
Logged In: YES 
user_id=148712

It is now apparent that this is the same bug as #455151. I'm
tagging this one as "Duplicate".
Log in (anonymous is fine) to add a comment.