Skip to content
Tcl Source Code View Ticket
Login

View Ticket

lsort -integer fails with wide integers

Closed / Fixed3216010fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 4 years ago
Descriptionplain2011-03-16 11:05:13
lsort -integer fails when trying to sort a list of wide integers (i.e. a list with timestamps, like clock milliseconds returns).

I see for example in Tcl_LsortObjCmd(), in file tclCmdIL.c, line 3911 (may have changed I haven't updated to fossil):

} else if (sortMode == SORTMODE_INTEGER) {
  long a;
  if (TclGetLongFromObj(sortInfo.interp, indexPtr, &a) != TCL_OK) {
    sortInfo.resultCode = TCL_ERROR;
    goto done1;
  }
  elementArray[i].index.intValue = a;

I think that Tcl_GetWideIntFromObj() should be called if Tcl_GetLongFromObj() fails, before returning an error to the caller...
dgpplain2011-03-16 22:28:38
data_type - 360894


This is not a bug.  It's preservation of compatible output
from [lsort -integer] across minor releases.

That may be an unwise choice, but changing it is a 
feature request.
dgpplain2011-03-18 04:20:12
See http://core.tcl.tk/tcl/info/cf82eb92c8
for a checkin implementing the requested
functionality as [lsort -entier].
dgpplain2011-03-18 04:21:08
Very much un(der)tested at this point, BTW.
jan.nijtmanswiki2022-11-22 22:43:38

Fixed [here]

jan.nijtmanswiki2022-11-22 22:45:30

Dup of [47d66253c9]

Log in (anonymous is fine) to add a comment.