Bwidget Source Code
View Ticket
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Ticket UUID: 3536709
Title: huddle get does not accept non-scalar dict keys
Type: Patch Version: None
Submitter: ethanp Created on: 2012-06-20 20:06:50
Subsystem: yaml Assigned To: kanryu6
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2013-07-04 17:43:46
Resolution: Not Applicable Here Closed By:
    Closed on:
Found a bug in how huddle dict objects lookup non-scalar keys.  The bug is in huddle::_key_reflexive and stems from the a non-scalar single key being passed via args (variadic mechanism).  The problem is that an extra set of curly braces ends up enclosing the key path when it finally gets passed to dict get (which errors).  A simple example is:
  set h [huddle create {a a} b]
  huddle get $h {a a}; # error thrown here

I've seen this bug in huddle versions 0.1.3 through 0.1.5.

A fix for this is attached along with some new tests, the files are modified versions of the huddle 0.1.5 source.
User Comments: ethanp added on 2012-06-21 03:11:26:
Here's the patch for the 0.1.5 version of huddle.tcl:
>     } elseif {$len == 1} {
>         set path [lindex $path 0]

For some reason I could not attach multiple files, so I only attached the test file.

ethanp added on 2012-06-21 03:06:51:
File Added - 446681: huddle.test