Tcl_ParseCommand doesn't set errorInfo for a wrong command
Closed / Invalid2141271fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2008-10-01 22:43:45
Please compile and run an attached .c file. When run it prints an empty errorInfo obtained after a particular wrong command. errorInfo should *always* be set if Tcl_ParseCommand returns and error.
yurivictplain2008-10-02 05:43:45
File Added - 295702: parse-error.c
dgpplain2008-10-02 22:57:19
Please report the version of Tcl in which you see the problem.
dgpplain2008-10-02 23:29:59
See the docs for Tcl_ParseCommand: "If an error occurred in parsing the command then TCL_ERROR is returned, an error message is left in interp’s result, and no information is left at *parsePtr." You will find the error message in the interp result, not in the ::errorInfo variable.
dgpplain2008-10-02 23:31:33
Use const char *msg = Tcl_GetStringResult(interp); to fix your code. If you also want ::errorInfo set, you can achieve that by adding Tcl_AddErrorInfo(interp,"") in the branch that handles the TCL_ERROR return values.
dgp Closed ticket [2141271fff].
[History diff]2008-10-02 23:32:57
yurivictplain2008-10-02 23:35:45
I see this problem in both tcl-8.4.19 and tcl-8.5.4 with a minor difference. In tcl-8.4.19 errorInfo is returned as an empty string and in tcl-8.5.4 -- as a null string.
yurivictplain2008-10-02 23:47:28
This is quite confusing that there are so many error message variables.
dgp Closed ticket [2141271fff].
[History diff]2008-10-02 23:55:48
Log in (anonymous is fine) to add a comment.
Attachments:
- parse-error.c [download] added by yurivict on 2008-10-02 05:43:45. [details]