Project

General

Profile

Bug #7722 » 0002-proc.c-original-arity.patch

proc.c: original arity - nobu (Nobuyoshi Nakada), 01/22/2013 04:29 PM

View differences:

proc.c
return rb_method_entry_arity(data->me);
}
static rb_method_entry_t *
original_method_entry(VALUE mod, ID id)
{
VALUE rclass;
rb_method_entry_t *me;
rb_method_definition_t *def;
while ((def = (me = rb_method_entry(mod, id, &rclass))->def) != 0 &&
me->def->type == VM_METHOD_TYPE_ZSUPER) {
mod = RCLASS_SUPER(rclass);
id = me->def->original_id;
}
return me;
}
int
rb_mod_method_arity(VALUE mod, ID id)
{
rb_method_entry_t *me = rb_method_entry(mod, id, 0);
rb_method_entry_t *me = original_method_entry(mod, id);
return rb_method_entry_arity(me);
}
test/ruby/test_marshal.rb
end
end
class TestForRespondToZSuper < TestForRespondToFalse
private :respond_to?
end
def test_marshal_respond_to_arity
assert_nothing_raised(ArgumentError) do
Marshal.dump(TestForRespondToFalse.new)
end
assert_nothing_raised(ArgumentError) do
Marshal.dump(TestForRespondToZSuper.new)
end
end
end
(2-2/2)