Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: aa6680bcfbcdbdbf2c24336d68d3ad3490d757abcd2317b1a5eda0e65085975d
Ticket: 30e4e9102f3f1080713ce7766719d1fc02ea8ab0
Tcl_ListObjIndex returns empty string instead of NULL for lseq
User & Date: apnadkarni on 2023-07-29 06:24:31
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-markdown"
  4. comment changed to:
    The `Tcl_ListObjIndex` command is documented to return `TCL_OK` and set the output `objPtr` to NULL in case the index is out of bounds. This is tested by the listObj-14.X tests and fails when the list is a lseq where an empty `Tcl_Obj` is returned in `objPtr` instead.
    
    My preference for a fix would be to define semantics of the `Tcl_ObjType.indexProc` to behave like `Tcl_ListObjIndex` and return NULL for this case (and `TCL_OK`).
    
    On a related note, the `Tcl_ObjType` methods including `indexProc` are documented in the manpages as paralleling the script level commands like `lindex`. This should really be documented as paralleling the C API for lists and should be implemented accordingly. (The TIP itself is silent on exact semantics). There are issues like sharing of objects etc. that do not arise at the script level but must be obeyed by the methods in the same manner as the public C API. There are also functional differences between the script and C levels, the above index bounds being just one. For folks writing abstract list variations, the distinction is important.
    
    /Ashok
    
  5. foundin changed to: "9.0"
  6. is_private changed to: "0"
  7. login: "apnadkarni"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "apnadkarni"
  14. subsystem changed to: "- New Builtin Commands"
  15. title changed to:
    Tcl_ListObjIndex returns empty string instead of NULL for lseq
    
  16. type changed to: "Bug"