Project

General

Profile

Bug #10496

Yaml: Serialization of cross-referrenced objects with psych

Added by jonnykh (Ivan Neverov) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
2.1.3p242, 1.9.3p550
[ruby-core:66215]

Description

I'm trying to run next code that serialize object B that has instance variable of A initialized with this B (cross referenced). After deserialization I'm getting 2 B objects instead of 1

https://gist.github.com/ineverov/3ce3ea21d970996b673e

During investigation of source code of psych I found that we don't register objects that use encode_with methods
Here: https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/visitors/yaml_tree.rb#L530

Associated revisions

Revision ecbf8351
Added by tenderlove over 4 years ago

  • ext/psych/lib/psych/visitors/yaml_tree.rb: register nodes when
    dumping objects with custom coders. [ruby-core:66215] [Bug #10496]

  • test/psych/test_coder.rb: test for fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 49529
Added by tenderlovemaking (Aaron Patterson) over 4 years ago

  • ext/psych/lib/psych/visitors/yaml_tree.rb: register nodes when
    dumping objects with custom coders. [ruby-core:66215] [Bug #10496]

  • test/psych/test_coder.rb: test for fix

Revision 49529
Added by tenderlove over 4 years ago

  • ext/psych/lib/psych/visitors/yaml_tree.rb: register nodes when
    dumping objects with custom coders. [ruby-core:66215] [Bug #10496]

  • test/psych/test_coder.rb: test for fix

Revision 49529
Added by tenderlove over 4 years ago

  • ext/psych/lib/psych/visitors/yaml_tree.rb: register nodes when
    dumping objects with custom coders. [ruby-core:66215] [Bug #10496]

  • test/psych/test_coder.rb: test for fix

Revision 49529
Added by tenderlove over 4 years ago

  • ext/psych/lib/psych/visitors/yaml_tree.rb: register nodes when
    dumping objects with custom coders. [ruby-core:66215] [Bug #10496]

  • test/psych/test_coder.rb: test for fix

Revision 49529
Added by tenderlove over 4 years ago

  • ext/psych/lib/psych/visitors/yaml_tree.rb: register nodes when
    dumping objects with custom coders. [ruby-core:66215] [Bug #10496]

  • test/psych/test_coder.rb: test for fix

History

Updated by duerst (Martin Dürst) over 4 years ago

  • Assignee changed from ruby-core to tenderlovemaking (Aaron Patterson)
#2

Updated by Anonymous over 4 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r49529.


  • ext/psych/lib/psych/visitors/yaml_tree.rb: register nodes when
    dumping objects with custom coders. [ruby-core:66215] [Bug #10496]

  • test/psych/test_coder.rb: test for fix

#3

Updated by wanabe (_ wanabe) over 4 years ago

  • Backport set to 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN

Also available in: Atom PDF