1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) r48111,r48118,r48120: [Backport #10421]

* 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/branches/ruby_2_1@48138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-10-25 18:42:44 +00:00
parent c4e838d011
commit eca3835c65
4 changed files with 18 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Sun Oct 26 03:31:46 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]
Sun Oct 26 03:21:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* class.c (unknown_keyword_error): delete expected keywords

View file

@ -298,6 +298,15 @@ class TestObject < Test::Unit::TestCase
$VERBOSE = false
def (Object.new).__send__; end
INPUT
bug10421 = '[ruby-dev:48691] [Bug #10421]'
assert_in_out_err([], <<-INPUT, ["1"], [], bug10421)
$VERBOSE = false
class C < BasicObject
def object_id; 1; end
end
puts C.new.object_id
INPUT
end
def test_remove_method

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.4"
#define RUBY_RELEASE_DATE "2014-10-26"
#define RUBY_PATCHLEVEL 263
#define RUBY_PATCHLEVEL 264
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 10

View file

@ -181,6 +181,7 @@ rb_free_method_entry(rb_method_entry_t *me)
xfree(me);
}
static inline rb_method_entry_t *search_method(VALUE klass, ID id, VALUE *defined_class_ptr);
static int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2);
static inline rb_method_entry_t *
@ -355,7 +356,7 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type,
}
/* check mid */
if (mid == object_id || mid == id__send__) {
if (type == VM_METHOD_TYPE_ISEQ) {
if (type == VM_METHOD_TYPE_ISEQ && search_method(klass, mid, 0)) {
rb_warn("redefining `%s' may cause serious problems", rb_id2name(mid));
}
}