Menu

#253 huddle get does not accept non-scalar dict keys

open
yaml (1)
5
2012-06-20
2012-06-20
ethanp
No

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.

Discussion

  • ethanp

    ethanp - 2012-06-20

    Modified huddle 0.1.5 test file.

     
  • ethanp

    ethanp - 2012-06-20

    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.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.