YAML.load and exception objects

I

IWATSUKI Hiroyuki

I found a problem about YAML.load() and exception objects.

% ruby -v -ryaml -e "YAML.load(Exception.new.to_yaml)"
ruby 1.8.2 (2004-06-19) [i386-cygwin]
/usr/local/lib/ruby/1.8/yaml/rubytypes.rb:274:in `object_maker': wrong
number of arguments (3 for 2) (ArgumentError)
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:274
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:272:in `call'
from -e:1:in `transfer'
from /usr/local/lib/ruby/1.8/yaml.rb:119:in `load'
from /usr/local/lib/ruby/1.8/yaml.rb:119:in `load'
from -e:1

I think so that the latest YAML.object_maker() in lib/yaml.rb was changed.

Index: rubytypes.rb
===================================================================
RCS file: /home/don/ruby/cvs/src/ruby/lib/yaml/rubytypes.rb,v
retrieving revision 1.24
diff -u -p -u -p -r1.24 rubytypes.rb
--- rubytypes.rb 25 May 2004 14:57:25 -0000 1.24
+++ rubytypes.rb 22 Jun 2004 18:43:51 -0000
@@ -271,7 +271,7 @@ end

YAML.add_ruby_type( /^exception/ ) { |type, val|
type, obj_class = YAML.read_type_class( type, Exception )
- o = YAML.object_maker( obj_class, { 'mesg' => val.delete( 'message' ) }, true )
+ o = YAML.object_maker( obj_class, { 'mesg' => val.delete( 'message' ) } )
val.each_pair { |k,v|
o.instance_variable_set("@#{k}", v)
}

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top