From 40508ede731122cdf2d13d39477317a529d4d4fd Mon Sep 17 00:00:00 2001 From: tenderlove Date: Tue, 21 Jun 2011 18:22:54 +0000 Subject: * ext/psych/lib/psych/visitors/to_ruby.rb: Fix cyclic references of objects. Thanks to CvX for reporting the bug and a test case. * test/psych/test_object.rb: test for cyclic object references. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/psych/lib/psych/visitors/to_ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index 2562816344..b8eb698754 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -182,7 +182,6 @@ module Psych when /^!ruby\/object:?(.*)?$/ name = $1 || 'Object' obj = revive((resolve_class(name) || Object), o) - @st[o.anchor] = obj if o.anchor obj when /^!map:(.*)$/, /^!ruby\/hash:(.*)$/ @@ -233,6 +232,7 @@ module Psych def revive klass, node s = klass.allocate + @st[node.anchor] = s if node.anchor h = Hash[*node.children.map { |c| accept c }] init_with(s, h, node) end -- cgit v1.2.3