Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b785af33c1304ffdf8878c7b039ad3871e7f29ef
Ticket: 2969488fffffffffffffffffffffffffffffffff
trace variable doesn't fire if you upvar to an array element
User & Date: ferrieux on 2010-03-13 07:15:08
Changes

  1. icomment:
    Attaching a patch doing 99% of the job :/
    (The 1% is failing tests in trace-16.* by giving a misleading error message "no such variable" vs "no such element in array". Will look into this later.)
    
    Method:
     (1) Enrich TclVarHashTable with an arrayPtr field, backlinking to the parent array when it exists, NULL otherwise.
     (2) Enrich the various TclIsVarDirectXXXable with proper tests on the parent array
     (3) At the beginning of the TclPtr(Set,Get,Incr,Unset) functions, when the arrayPtr passed is NULL, check again, and overwrite it with the parent array from the table.
    
    As a result, array elements now know their parent, *and* the superficial arrayPtr estimated from the var's syntax (an upvar may look like a scalar) is no longer  enough to hide the truth.
    
    Doc update is just the removal of that ugly paragraph describing the old behavior.
    
    Tests need a specific case checking for this (apparently no one bothered to test that ugly documented behavior !)
    
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"