Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Tcl_WrongNumArgs() incompatibility

Closed / Fixed1066837fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-11-15 18:05:03
Tcl_WrongNumArgs() was
recently changed on the HEAD
to treat objv elements as list
elements when constructing
error messages (quite arguably,
as it always should have been).

This is incompatible with prior
behavior that constructed error
messages with simple string
concatenation.

The result is that the error message
construction for Itcl ensembles is
now broken, and 8 tests in the Itcl
test suite fail.

Compatibility should  be restored
before Tcl 8.5a2 release.  Perhaps
a Tcl_WrongNumArgsEx() is the
acceptable way to introduce a
properly working routine?
dkfplain2004-11-16 16:51:25
Logged In: YES 
user_id=79902

I don't understand the failure mode yet, since as far as I
can see Itcl ensembles don't touch Tcl_WrongNumArgs at all.
Please provide more information.
dgpplain2004-11-16 23:32:40
Logged In: YES 
user_id=80530

ok, one failing test in Itcl's test suite is:

==== info-4.1a query class (wrong # args) FAILED
==== Contents of test case:

    list [catch {ti info class x} result] $result

---- Result was:
1 {wrong # args: should be "{info class}"}
---- Result should have been (exact matching):
1 {wrong # args: should be "info class"}
==== info-4.1a FAILED

Within the Itcl_BiInfoClassCmd() routine,
the error message is constructed with
a call to Tcl_WrongNumArgs():

  if (objc != 1) {
    Tcl_WrongNumArgs(interp, 1, objv, NULL);
     return TCL_ERROR;
  }

At this point, objc==2 and the contents of objv are:

  objv[0] = "info class"
  objv[1] = "x"

The piling of all the leading words into
objv[0] is a "feature" of Itcl's ensemble
mechanism.

Since T_WNA was changed to quote
that leading objv[0] as a single list 
element, the error message is now
incorrect.
dkfplain2004-11-17 05:22:34
Logged In: YES 
user_id=79902

Hmm, examining what Itcl does, I see that the workaround is
to *not* listify the first object. Clunky... :^/
dkfplain2004-11-17 06:21:51
Logged In: YES 
user_id=79902

Clashes with bug 942757 (see test proc-3.6)
dkfplain2004-11-25 23:38:40
Logged In: YES 
user_id=79902

Fixed and placed #ifdef-ery in so that the fix looks ugly;
it's supposed to look ugly, since what it is doing sure
isn't pretty!
Log in (anonymous is fine) to add a comment.