Issue #11966 has been reported by Brian Storti.

----------------------------------------
Bug #11966: YAML#load fails with OpenStruct object
https://bugs.ruby-lang.org/issues/11966

* Author: Brian Storti
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290)
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
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>'
~~~



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>