Bug #4401

override :method method breaks Psych

Added by Lin Jen-Shin almost 5 years ago. Updated over 4 years ago.

Assignee:Aaron Patterson
ruby -v:ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0] Backport:


I am not sure if this could be considered a bug, but it used to work.
To reproduce it:

ruby -r psych -v -e 'Psych.dump(Struct.new(:method).new)'
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]
/usr/local/Cellar/ruby/1.9.2-p136/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:48:in method': wrong number of arguments(1 for 0) (ArgumentError)
from /usr/local/Cellar/ruby/1.9.2-p136/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:48:in
from /usr/local/Cellar/ruby/1.9.2-p136/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:36:in <<'
from /usr/local/Cellar/ruby/1.9.2-p136/lib/ruby/1.9.1/psych.rb:165:in
from -e:1:in `'

I don't have a good idea how to fix it,
but here's some demonstration:


Patches attached as well, the same as above two commits.
I think they are against r30885.

Many thanks!

p.s. this issue was found in delayed_job's:
class PerformableMethod < Struct.new(:object, :method, :args)

0001-psych-visitors-yaml_tree.rb-use-public_method-instea.patch Magnifier (2.77 KB) Lin Jen-Shin, 02/16/2011 12:12 AM

0002-psych-visitors-yaml_tree.rb-skip-warning-when-excpt-.patch Magnifier (2.69 KB) Lin Jen-Shin, 02/16/2011 12:12 AM


#1 Updated by Lin Jen-Shin almost 5 years ago

The other way, might be:


Either way is fine for me.

#2 Updated by Charles Nutter almost 5 years ago

Fails the same in JRuby (we just reuse Psych's .rb code): http://jira.codehaus.org/browse/JRUBY-5520

#3 Updated by Shyouhei Urabe over 4 years ago

  • Status changed from Open to Assigned

#4 Updated by Koichi Sasada over 4 years ago

Aaron, how about it?

#5 Updated by Aaron Patterson over 4 years ago

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

This was fixed in r31075. I'm not sure why redmine didn't automatically close.

Also available in: Atom PDF