vm_method.c: no redefinition warnings for undefined methods
* vm_method.c (rb_method_entry_make): warn redefinition only for already defined methods, but not for undefined methods. [ruby-dev:48691] [Bug #10421] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
93647e81a6
commit
8dc89b34c1
@ -1,3 +1,9 @@
|
|||||||
|
Thu Oct 23 19:13:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* vm_method.c (rb_method_entry_make): warn redefinition only for
|
||||||
|
already defined methods, but not for undefined methods.
|
||||||
|
[ruby-dev:48691] [Bug #10421]
|
||||||
|
|
||||||
Thu Oct 23 17:19:04 2014 Kouhei Sutou <kou@cozmixng.org>
|
Thu Oct 23 17:19:04 2014 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rexml/source.rb (REXML::IOSource#encoding_updated): Fix a
|
* lib/rexml/source.rb (REXML::IOSource#encoding_updated): Fix a
|
||||||
|
@ -318,6 +318,12 @@ class TestObject < Test::Unit::TestCase
|
|||||||
$VERBOSE = false
|
$VERBOSE = false
|
||||||
def (Object.new).__send__; end
|
def (Object.new).__send__; end
|
||||||
INPUT
|
INPUT
|
||||||
|
|
||||||
|
bug10421 = '[ruby-dev:48691] [Bug #10421]'
|
||||||
|
assert_in_out_err([], <<-INPUT, [], [], bug10421)
|
||||||
|
$VERBOSE = false
|
||||||
|
def (BasicObject.new).object_id; end
|
||||||
|
INPUT
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_remove_method
|
def test_remove_method
|
||||||
|
@ -379,7 +379,7 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type,
|
|||||||
}
|
}
|
||||||
/* check mid */
|
/* check mid */
|
||||||
if (mid == object_id || mid == id__send__) {
|
if (mid == object_id || mid == id__send__) {
|
||||||
if (type == VM_METHOD_TYPE_ISEQ) {
|
if (type == VM_METHOD_TYPE_ISEQ && rb_method_boundp(klass, mid, 0)) {
|
||||||
rb_warn("redefining `%s' may cause serious problems", rb_id2name(mid));
|
rb_warn("redefining `%s' may cause serious problems", rb_id2name(mid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user