Backport #2202

Call to a removed method doesn't raise an exception

Added by Tomas Matousek over 2 years ago. Updated 10 months ago.

[ruby-core:26074]
Status:Closed Start date:10/14/2009
Priority:Normal Due date:
Assignee:Kirk Haines % Done:

100%

Category:-
Target version:-

Description

obj = Object.new

s = class << obj
  alias_method :rt, :respond_to?
  self
end

p obj.methods(false)             # [:rt]
p obj.rt(:bar)                   # returns false as expected
s.send(:remove_method, :rt)      # removes :rt method
p obj.methods(false)             # []
obj.rt(:foo)                     # this should raise an exception but it doesn’t




D:\temp>ruby19 -v a.rb
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32]
[:rt]
false
[]

D:\temp>ruby -v a.rb
ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]
["rt"]
false
[]

Related issues

duplicates Ruby 1.8 - Bug #2203: Call to a removed method doesn't raise an exception Closed 10/14/2009
duplicates Ruby 1.8 - Bug #2204: Call to a removed method doesn't raise an exception Closed 10/14/2009
duplicates Ruby 1.8 - Bug #2205: Call to a removed method doesn't raise an exception Closed 10/14/2009

Associated revisions

Revision 25359
Added by nobu over 2 years ago

* eval.c (rb_clear_cache_for_undef): clear entries for inherited methods. [ruby-core:26074]

Revision 28229
Added by wyhaines over 1 year ago

eval.c: Backport #2202 [ruby-core:26074]; backport of r25359, which modifies rb_clear_cache_for_undef to clear entries for inherited methods. test/ruby/test_object.rb: Backport #2202 [ruby-core:26074]; Added this file, from r25359, which tests a number of behaviors of Object, including this change. This version differs from the one in r25359 because there are several tests which currently fail on 1.8.6 because those capabilities are not implemented. Those tests are commented out.

History

Updated by Nobuyoshi Nakada over 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r25359.
Tomas, thank you for your reporting of the issue.
You have greatfully contributed toward Ruby.
May Ruby be with you.

Updated by Shyouhei Urabe about 2 years ago

  • Status changed from Closed to Assigned
  • Assignee set to Kirk Haines
  • Priority changed from High to Normal
As the original message reports, 1.8.6 has this issue and should backport the fix.

Updated by Kirk Haines over 1 year ago

  • Status changed from Assigned to Closed
This issue was solved with changeset r28229.
Tomas, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF