Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2008-10-02
23:55 • Closed ticket [2141271fff]: Tcl_ParseCommand doesn't set errorInfo for a wro... artifact: 3596377ad5 user: dgp
23:47 • Ticket [2141271fff]: 4 changes artifact: f078d793bf user: yurivict
23:35 • Open ticket [2141271fff]. artifact: 55c3b183a1 user: yurivict
23:32 • Closed ticket [2141271fff]. artifact: 107710084d user: dgp
23:31 • Ticket [2141271fff]: 4 changes artifact: f58f59f79b user: dgp
23:29 • Ticket [2141271fff]: 4 changes artifact: ec300a0f16 user: dgp
22:57 • Ticket [2141271fff]: 6 changes artifact: 4c39008ad9 user: dgp
05:43 • Ticket [2141271fff]: 4 changes artifact: e1bf9035c2 user: yurivict
05:43 • Add attachment parse-error.c to ticket [2141271fff] artifact: ed4393348a user: yurivict
2008-10-01
22:43 • New ticket [2141271fff] Tcl_ParseCommand doesn't set errorInfo for a wrong c... artifact: 7e0853fd08 user: yurivict

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: