|
jingweno |
Fix bug that causes YAML serialization problem for Exception.
…
The implementation of YAML.object_maker allocates an object and instance_variable_set the instance variables passed as the second argument, while Exception doesn't seem to use such instance variable to return the exception message (Exception#message). This bug can be reproduced by typing YAML::load(YAML::dump(Exception.new('test_message'))) in IRB. |
f0d970c
|
The problem is related to Exception#message not being correctly un-serialized. This bug can be reproduced with executing:
YAML::load(YAML::dump(Exception.new('test_message')))
I proposed a fix. Please take a look.
(comment) This doesn't happen with Psych.
But some popular gems such as delayed_job (https://github.com/collectiveidea/delayed_job/blob/master/lib/delayed/yaml_ext.rb) are still depending on syck. What's the road map for syck? Is Psych going to replace syck? Why are there two implementations for YAML serialization?
Hey, I just pointed out the fact. Nothing more. This can still be pulled.
However if you want a concrete road map of syck this is not the place for it. Please move to http://redmine.ruby-lang.org/projects/ruby-19/issues/new .
Oh...I was just trying to understand whether this is a real bug or not, your comment kinda confused me. Thanks for the clarification :). Hope this one will be fixed in the next Ruby release :).
Hi, can I confirm that this bug has been recognized and close the pull request? Thanks
Since I haven't got response till now, I created a bug report: http://redmine.ruby-lang.org/issues/5415
Applied at r34908.
Fix bug that causes YAML serialization problem for Exception. …
The implementation of YAML.object_maker allocates an object and instance_variable_set the instance variables passed as the second argument, while Exception doesn't seem to use such instance variable to return the exception message (Exception#message). This bug can be reproduced by typing YAML::load(YAML::dump(Exception.new('test_message'))) in IRB.
The implementation of YAML.object_maker allocates an object and
instance_variable_set the instance variables passed as the second
argument, while Exception doesn't seem to use such instance variable to
return the exception message (Exception#message). This bug can be
reproduced by typing
YAML::load(YAML::dump(Exception.new('test_message'))) in IRB, e.g.,
ruby-1.9.2-p290 :001 > require 'yaml'
=> true
ruby-1.9.2-p290 :002 > YAML::load(YAML::dump(Exception.new('test_message')))
=> #<Exception: Exception>
#<Exception: "test_message"> is expected while the result is #<Exception: Exception>.