From: "zenspider (Ryan Davis)" Date: 2012-12-29T13:35:21+09:00 Subject: [ruby-core:51180] [ruby-trunk - Bug #7564] r38175 introduces incompatibility Issue #7564 has been updated by zenspider (Ryan Davis). I still think this is a bug, as shown by needing a respond_to? that does nothing more than call super: class Sexp < Array def inspect "s(#{map(&:inspect).join ', '})" end def respond_to? meth super end if ENV["WHY_DO_I_NEED_THIS"] def method_missing meth, delete = false raise "shouldn't be here: #{meth.inspect}" end end def s *args Sexp.new args end p Marshal.load Marshal.dump s(1, 2, 3) puts # % WHY_DO_I_NEED_THIS=1 ruby20 trunk_bug.rb && ruby20 trunk_bug.rb # s(1, 2, 3) # # trunk_bug.rb:11:in `method_missing': shouldn't be here: :marshal_dump (RuntimeError) # from trunk_bug.rb:19:in `dump' # from trunk_bug.rb:19:in `
' ---------------------------------------- Bug #7564: r38175 introduces incompatibility https://bugs.ruby-lang.org/issues/7564#change-35131 Author: tenderlovemaking (Aaron Patterson) Status: Rejected Priority: Normal Assignee: mame (Yusuke Endoh) Category: core Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1] r38175 introduces incompatibility with 1.9.3. Before r38175, when looking for _dump, Marshal would not call method_missing. Now marshal calls method_missing when trying to dump. The following example exits with no error on 1.9.3, but on trunk it raises an exception (_dump() must return string (TypeError)): class TR def initialize calls = [] @calls = calls end def method_missing name, *args @calls << [name, args] end end Marshal.dump TR.new I've attached a test case. -- http://bugs.ruby-lang.org/