* 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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2015-01-28 17:37:09 +00:00
parent 8914d672b8
commit 6ce27adabe
5 changed files with 18 additions and 2 deletions

View File

@ -1,3 +1,11 @@
Thu Jan 29 02:34:27 2015 Aaron Patterson <aaron@tenderlovemaking.com>
* 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@80x24.org> Thu Jan 29 02:06:09 2015 Eric Wong <e@80x24.org>
* thread.c (struct join_arg): restructure and make smaller * thread.c (struct join_arg): restructure and make smaller

View File

@ -217,7 +217,7 @@ require 'psych/class_loader'
module Psych module Psych
# The version is Psych you're using # The version is Psych you're using
VERSION = '2.0.10' VERSION = '2.0.12'
# The version of libyaml Psych is using # The version of libyaml Psych is using
LIBYAML_VERSION = Psych.libyaml_version.join '.' LIBYAML_VERSION = Psych.libyaml_version.join '.'

View File

@ -263,6 +263,7 @@ module Psych
when /^!ruby\/hash-with-ivars(?::(.*))?$/ when /^!ruby\/hash-with-ivars(?::(.*))?$/
hash = $1 ? resolve_class($1).allocate : {} hash = $1 ? resolve_class($1).allocate : {}
register o, hash
o.children.each_slice(2) do |key, value| o.children.each_slice(2) do |key, value|
case key.value case key.value
when 'elements' when 'elements'

View File

@ -2,7 +2,7 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "psych" 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.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"] s.require_paths = ["lib"]

View File

@ -23,6 +23,13 @@ module Psych
@hash = { :a => 'b' } @hash = { :a => 'b' }
end 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 def test_custom_initialized
a = [1,2,3,4,5] a = [1,2,3,4,5]
t1 = HashWithCustomInit.new(a) t1 = HashWithCustomInit.new(a)