Wrong return code from catch with pure list
Closed / Fixed2102930fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2008-09-10 01:43:20
The [catch] command seems to return the wrong return code when a pure list is passed as the script:
% catch break
3
% catch { break }
3
% catch [list break]
1
% set errorInfo
invoked "break" outside of a loop
...
Correct return should be 3 (TCL_BREAK) in all cases.
Bug seems specific to 8.6.
Neil
dkf Ticket [2102930fff]: 3 changes
[History diff]2008-09-10 17:37:12
msoferplain2008-09-10 18:20:24
Problem seems to be that the bytecompiling INST_EVALSTK does not manage iPtr->numLevels
msoferplain2008-09-10 20:25:19
The bug can only happen at the console (where bytecodes can run at level 0) and is triggered by INST_EVAL_STK neither upping the level nor setting TCL_EVAL_NOERR. We normally do not care much about numLevels, except for checking the recursion level and converting some codes to TCL_ERROR at level 0. TEBC is particularly lax about setting numLevels for scripts embedded in it (no deep recursion is possible, it would have blown the compiler first), but in the case of INST_EVAL_STK at level 0 it seems to be important. It only happens for canonical lists because the other case is handled within TEBC itself and the level check is omitted.
Log in (anonymous is fine) to add a comment.