Menu

#2489 Tcl_GetIndexFromObjStruct doesn't reset result before error

obsolete: 8.4.5
closed-fixed
5
2006-03-25
2003-09-26
No

Tcl_GetIndexFromObjStruct doesn't reset prior result
information in the interpreter when generating its
so-called (in the comments) "fancy error message".
This means that if you've done something that has set a
result before calling it or Tcl_GetIndexFromObj
(including calling Tcl_GetIndexFromObj multiple times
with multiple errors) you get bogus error messages.

In the particular case I noticed this, I have an ObjCmd
that separates out certain option arguments that it
wants and delegates the remaining options to another
ObjCmd. Here I use the TCL_ERROR vs. TCL_OK result to
determine whether an option was matched within the set
that the first function wants. It's a little more
maintainable this way (though perhaps slower with all
those error messages being generated) to have the first
function only know about the small subset of options
that it wants. At any rate, I noticed that when
feeding the command a bunch of options where one wasn't
recognized by either generated an error message with
repeated error messages and other result bits.

See below for suggested patch.

Discussion

  • Michael Kirkham

    Michael Kirkham - 2003-09-26

    Patch for TGIFOS error results

     
  • Michael Kirkham

    Michael Kirkham - 2003-09-26

    Logged In: YES
    user_id=498198

    Seems to be more of a pandemic issue than just this
    function. See bug #533364. Just thought I should note it
    for reference (maybe someone wants to mark this as a
    duplicate or make a single bug entry for fixing this on a
    global scale).

     
  • Don Porter

    Don Porter - 2003-11-13
    • milestone: --> obsolete: 8.4.5
     
  • Don Porter

    Don Porter - 2006-03-10

    Logged In: YES
    user_id=80530

    Is this report still valid?

     
  • Don Porter

    Don Porter - 2006-03-10

    Logged In: YES
    user_id=80530

    the specifc bug reported
    has been fixed, and I believe
    the general issue has been
    corrected too.

    See 2004-10-06 ChangeLog entry.

     
  • Don Porter

    Don Porter - 2006-03-10
    • assigned_to: nijtmans --> dgp
    • status: open --> pending-fixed
     
  • SourceForge Robot

    • status: pending-fixed --> closed-fixed
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).