Actions
Bug #11966
closedYAML#load fails with OpenStruct object
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290)
Description
Code that can be used to reproduce the issue (works on 2.2.3, fails on 2.3.0):
require 'ostruct'
require 'yaml'
yaml = "
args:
- !ruby/object:OpenStruct
table:
:body: foo "
YAML.load(yaml)
Stacktrace:
/opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/ostruct.rb:176:in `respond_to_missing?': undefined method `key?' for nil:NilClass (NoMethodError)
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:381:in `respond_to?'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:381:in `init_with'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:374:in `revive'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:208:in `visit_Psych_Nodes_Mapping'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/visitor.rb:16:in `visit'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/visitor.rb:6:in `accept'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:32:in `accept'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:330:in `block in register_empty'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:330:in `each'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:330:in `register_empty'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Sequence'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/visitor.rb:16:in `visit'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/visitor.rb:6:in `accept'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:32:in `accept'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:338:in `block in revive_hash'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:336:in `each'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:336:in `each_slice'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:336:in `revive_hash'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:162:in `visit_Psych_Nodes_Mapping'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/visitor.rb:16:in `visit'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/visitor.rb:6:in `accept'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:32:in `accept'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:311:in `visit_Psych_Nodes_Document'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/visitor.rb:16:in `visit'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/visitor.rb:6:in `accept'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/visitors/to_ruby.rb:32:in `accept'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych/nodes/node.rb:38:in `to_ruby'
from /opt/boxen/rbenv/versions/2.3.0/lib/ruby/2.3.0/psych.rb:253:in `load'
from ostruct.rb:10:in `<main>'
Actions
Like0
Like0Like0Like0