Ticket #25 (new defect)
Opened 2 years ago
yaml.rb produces YAML it can't parse from Sets of Hashes
| Reported by: | whateley | Owned by: | somebody |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | component1 | Version: | |
| Keywords: | Cc: | whateley@… |
Description
I'm producing YAML that contains multiple Sets, each of which may contain the same instance of a Hash. to_yaml works, but YAML.load says the result has got a syntax error.
Here's a test program:
require "set"
require "yaml"
# it only seems to occur with hashes
b = { "z" => 2 }
# the Sets must be two different instances
s1 = Set.new([b])
s2 = s1.dup
yaml = [s1,s2].to_yaml
YAML.load(yaml)
And here's the output:
/usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 4, col -1: ` z: 2 (ArgumentError)
: true
- !ruby/object:Set
hash:
*id001: true
' from /usr/lib/ruby/1.8/yaml.rb:133:in `load'
from /home/therion/test.rb:14
This is on ruby 1.8.5 (2006-12-04 patchlevel 2) [i686-linux]
Note: See
TracTickets for help on using
tickets.