merge revision(s) 42903: [Backport #8881]

* class.c (method_entry_i): should exclude refined methods from
	  instance method list.  [ruby-core:57080] [Bug #8881]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2013-09-12 16:08:31 +00:00
parent 3041c43df1
commit b55e9b7bf5
4 changed files with 21 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Fri Sep 13 00:57:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* class.c (method_entry_i): should exclude refined methods from
instance method list. [ruby-core:57080] [Bug #8881]
Fri Sep 13 00:33:09 2013 Charlie Somerville <charliesome@ruby-lang.org> Fri Sep 13 00:33:09 2013 Charlie Somerville <charliesome@ruby-lang.org>
* vm_eval.c (vm_call0): fix prototype, the id parameter should be of * vm_eval.c (vm_call0): fix prototype, the id parameter should be of

View file

@ -989,6 +989,10 @@ method_entry_i(st_data_t key, st_data_t value, st_data_t data)
st_table *list = (st_table *)data; st_table *list = (st_table *)data;
long type; long type;
if (me && me->def->type == VM_METHOD_TYPE_REFINED) {
me = rb_resolve_refined_method(Qnil, me, NULL);
if (!me) return ST_CONTINUE;
}
if (!st_lookup(list, key, 0)) { if (!st_lookup(list, key, 0)) {
if (UNDEFINED_METHOD_ENTRY_P(me)) { if (UNDEFINED_METHOD_ENTRY_P(me)) {
type = -1; /* none */ type = -1; /* none */

View file

@ -847,6 +847,17 @@ class TestRefinement < Test::Unit::TestCase
RUBY RUBY
end end
def test_instance_methods
bug8881 = '[ruby-core:57080] [Bug #8881]'
assert_not_include(Foo.instance_methods(false), :z, bug8881)
assert_not_include(FooSub.instance_methods(true), :z, bug8881)
end
def test_method_defined
assert_not_send([Foo, :method_defined?, :z])
assert_not_send([FooSub, :method_defined?, :z])
end
private private
def eval_using(mod, s) def eval_using(mod, s)

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0" #define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2013-09-13" #define RUBY_RELEASE_DATE "2013-09-13"
#define RUBY_PATCHLEVEL 306 #define RUBY_PATCHLEVEL 307
#define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_YEAR 2013
#define RUBY_RELEASE_MONTH 9 #define RUBY_RELEASE_MONTH 9