Tk Library Source Code

View Ticket
Login
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: aku
Priority: 5 Medium Severity: Minor
Status: Deleted Last Modified: 2013-06-06 18:05:01
Resolution: Not Applicable Here Closed By: aku
    Closed on: 2013-06-06 18:05:01
Description:
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:
242a243,244
>     } 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

Attachments: