Bug #7722

[rubyspec] failure in core/marshal/dump_spec.rb

Added by Nobuyoshi Nakada about 1 year ago. Updated about 1 year ago.

[ruby-core:51560]
Status:Closed
Priority:Urgent
Assignee:Yukihiro Matsumoto
Category:core
Target version:2.0.0
ruby -v:r38118 and later Backport:

Description

=begin
Since r38118, (({test-rubyspect})) fails in ((%rubyspec/core/marshal/dump_spec.rb%)).

  • Before r38117
    $ export MSPECOPT='-e "Marshal.dump with an Object dumps a BasicObject subclass if it defines respondto?" core/marshal/dumpspec.rb'
    $ make test-rubyspec
    ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems ./spec/mspec/bin/mspec run -B ./spec/default.mspec -e "Marshal.dump with an Object dumps a BasicObject subclass if it defines respondto?" core/marshal/dumpspec.rb
    ruby 2.0.0dev (2012-12-01 trunk 38117) [x86_64-darwin11.4.2]
    .

    Finished in 0.045351 seconds

    1 file, 1 example, 1 expectation, 0 failures, 0 errors

  • After r38117
    $ make test-rubyspec
    ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems ./spec/mspec/bin/mspec run -B ./spec/default.mspec -e "Marshal.dump with an Object dumps a BasicObject subclass if it defines respondto?" core/marshal/dumpspec.rb
    ruby 2.0.0dev (2012-12-01 trunk 38118) [x86_64-darwin11.4.2]
    E

    1)
    Marshal.dump with an Object dumps a BasicObject subclass if it defines respondto? ERROR
    ArgumentError: wrong number of arguments (2 for 1)
    /tmp/ruby/trunk/feature-6539/spec/rubyspec/core/marshal/fixtures/marshal
    data.rb:158:in respond_to?'
    /tmp/ruby/trunk/feature-6539/spec/rubyspec/core/marshal/dump_spec.rb:397:in
    dump'
    /tmp/ruby/trunk/feature-6539/spec/rubyspec/core/marshal/dump_spec.rb:397:in block (4 levels) in <top (required)>'
    /tmp/ruby/trunk/feature-6539/spec/rubyspec/core/marshal/dump_spec.rb:5:in
    '

    Finished in 0.045077 seconds

    1 file, 1 example, 0 expectations, 0 failures, 1 error
    make: *** [test-rubyspec] Error 1

r38118 changes to call (({respondto?})) method with ((|includeall|)) as (({true})), so
that private methods can be found, cf. [Feature #6539]

The choces what I can thought out are:

(1) change RubySpect to take the flag as a rest argument
(2) reject Feature #6539 call respond_to? according to its arity

Attach the patches for (3).
=end

0001-vm_method.c-drop-include_all-flag.patch Magnifier - vm_method.c: drop include_all flag (1.51 KB) Nobuyoshi Nakada, 01/22/2013 04:29 PM

0002-proc.c-original-arity.patch Magnifier - proc.c: original arity (1.79 KB) Nobuyoshi Nakada, 01/22/2013 04:29 PM

Associated revisions

Revision 39069
Added by Nobuyoshi Nakada about 1 year ago

vmmethod.c: drop includeall flag

  • vmmethod.c (rbobjrespondto): drop optional includeall flag if respondto? method is defined in old style. [Bug #7722]

History

#1 Updated by Nobuyoshi Nakada about 1 year ago

  • Description updated (diff)

#2 Updated by Koichi Sasada about 1 year ago

  • Priority changed from Normal to Urgent
  • Target version set to 2.0.0

#3 Updated by Yukihiro Matsumoto about 1 year ago

I am not that confident that I understand all the detail, but I vote for drop include_all flags.

Matz.

#4 Updated by Marc-Andre Lafortune about 1 year ago

The issue is that rb_obj_respond_to sends a second argument (include private) even when the user method doesn't accept one.

It should be fixed to only send one in those cases.

This is exactly what check_funcall_respond_to does already.

Both functions should probably be refactored.

#5 Updated by Nobuyoshi Nakada about 1 year ago

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

This issue was solved with changeset r39069.
Nobuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


vmmethod.c: drop includeall flag

  • vmmethod.c (rbobjrespondto): drop optional includeall flag if respondto? method is defined in old style. [Bug #7722]

Also available in: Atom PDF