ruby-changes:37351
From: tenderlove <ko1@a...>
Date: Thu, 29 Jan 2015 02:37:26 +0900 (JST)
Subject: [ruby-changes:37351] tenderlove:r49432 (trunk): * ext/psych/lib/psych/visitors/to_ruby.rb: fix parsing hashes with
tenderlove 2015-01-29 02:37:09 +0900 (Thu, 29 Jan 2015) New Revision: 49432 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49432 Log: * ext/psych/lib/psych/visitors/to_ruby.rb: fix parsing hashes with instance variables when it is referenced multiple times. * ext/psych/lib/psych.rb: bump version * ext/psych/psych.gemspec: bump version * test/psych/test_hash.rb: test for fix Modified files: trunk/ChangeLog trunk/ext/psych/lib/psych/visitors/to_ruby.rb trunk/ext/psych/lib/psych.rb trunk/ext/psych/psych.gemspec trunk/test/psych/test_hash.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 49431) +++ ChangeLog (revision 49432) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jan 29 02:34:27 2015 Aaron Patterson <aaron@t...> + + * ext/psych/lib/psych/visitors/to_ruby.rb: fix parsing hashes with + instance variables when it is referenced multiple times. + * ext/psych/lib/psych.rb: bump version + * ext/psych/psych.gemspec: bump version + * test/psych/test_hash.rb: test for fix + Thu Jan 29 02:06:09 2015 Eric Wong <e@8...> * thread.c (struct join_arg): restructure and make smaller Index: ext/psych/lib/psych/visitors/to_ruby.rb =================================================================== --- ext/psych/lib/psych/visitors/to_ruby.rb (revision 49431) +++ ext/psych/lib/psych/visitors/to_ruby.rb (revision 49432) @@ -263,6 +263,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/visitors/to_ruby.rb#L263 when /^!ruby\/hash-with-ivars(?::(.*))?$/ hash = $1 ? resolve_class($1).allocate : {} + register o, hash o.children.each_slice(2) do |key, value| case key.value when 'elements' Index: ext/psych/lib/psych.rb =================================================================== --- ext/psych/lib/psych.rb (revision 49431) +++ ext/psych/lib/psych.rb (revision 49432) @@ -217,7 +217,7 @@ require 'psych/class_loader' https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych.rb#L217 module Psych # The version is Psych you're using - VERSION = '2.0.10' + VERSION = '2.0.12' # The version of libyaml Psych is using LIBYAML_VERSION = Psych.libyaml_version.join '.' Index: ext/psych/psych.gemspec =================================================================== --- ext/psych/psych.gemspec (revision 49431) +++ ext/psych/psych.gemspec (revision 49432) @@ -2,7 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/psych/psych.gemspec#L2 Gem::Specification.new do |s| s.name = "psych" - s.version = "2.0.10" + s.version = "2.0.12" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] Index: test/psych/test_hash.rb =================================================================== --- test/psych/test_hash.rb (revision 49431) +++ test/psych/test_hash.rb (revision 49432) @@ -23,6 +23,13 @@ module Psych https://github.com/ruby/ruby/blob/trunk/test/psych/test_hash.rb#L23 @hash = { :a => 'b' } end + def test_referenced_hash_with_ivar + a = [1,2,3,4,5] + t1 = [HashWithCustomInit.new(a)] + t1 << t1.first + assert_cycle t1 + end + def test_custom_initialized a = [1,2,3,4,5] t1 = HashWithCustomInit.new(a) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/