Skip to content

Commit 4c06646

Browse files
committed
fix a bug in Module#remove_method which it could call undefined method if call it once
Test Code: ---- class Foo def meth end end obj = Foo.new obj.meth class Foo remove_method :meth end p obj.meth Result: ---- $ macruby test_remove.rb nil Expected: ---- $ ruby test_remove.rb test_remove.rb:12:in `<main>': undefined method `meth' for #<Foo:0x007fad558b9cc8> (NoMethodError)
1 parent b870681 commit 4c06646

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

vm.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,6 +2871,7 @@ RoxorCore::remove_method(Class klass, SEL sel)
28712871
assert(m != NULL);
28722872
method_setImplementation(m, (IMP)rb_vm_removed_imp);
28732873
invalidate_respond_to_cache();
2874+
invalidate_method_cache(sel);
28742875

28752876
ID mid = sanitize_mid(sel);
28762877
if (mid != 0) {

0 commit comments

Comments
 (0)