mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 50430,50440: [Backport #11117]
* vm_eval.c (rb_method_call_status): undefined refined method is not callable unless using. [ruby-core:69064] [Bug #11117] * vm_eval.c (rb_method_call_status): resolve refined method entry to check if undefined. [ruby-core:69064] [Bug #11117] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@51119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dffe87c720
commit
1bd36e36e0
4 changed files with 43 additions and 1 deletions
10
ChangeLog
10
ChangeLog
|
|
@ -1,3 +1,13 @@
|
|||
Fri Jul 3 17:53:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_eval.c (rb_method_call_status): resolve refined method entry
|
||||
to check if undefined. [ruby-core:69064] [Bug #11117]
|
||||
|
||||
Fri Jul 3 17:53:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_eval.c (rb_method_call_status): undefined refined method is
|
||||
not callable unless using. [ruby-core:69064] [Bug #11117]
|
||||
|
||||
Fri Jul 3 17:44:27 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (rb_file_load_ok): try opening file without gvl not to
|
||||
|
|
|
|||
|
|
@ -1399,6 +1399,33 @@ class TestRefinement < Test::Unit::TestCase
|
|||
INPUT
|
||||
end
|
||||
|
||||
def test_check_funcall_undefined
|
||||
bug11117 = '[ruby-core:69064] [Bug #11117]'
|
||||
|
||||
x = Class.new
|
||||
Module.new do
|
||||
refine x do
|
||||
def to_regexp
|
||||
//
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert_nothing_raised(NoMethodError, bug11117) {
|
||||
assert_nil(Regexp.try_convert(x.new))
|
||||
}
|
||||
end
|
||||
|
||||
def test_funcall_inherited
|
||||
bug11117 = '[ruby-core:69064] [Bug #11117]'
|
||||
|
||||
Module.new {refine(Dir) {def to_s; end}}
|
||||
x = Class.new(Dir).allocate
|
||||
assert_nothing_raised(NoMethodError, bug11117) {
|
||||
x.inspect
|
||||
}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def eval_using(mod, s)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.1.7"
|
||||
#define RUBY_RELEASE_DATE "2015-07-03"
|
||||
#define RUBY_PATCHLEVEL 370
|
||||
#define RUBY_PATCHLEVEL 371
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2015
|
||||
#define RUBY_RELEASE_MONTH 7
|
||||
|
|
|
|||
|
|
@ -533,8 +533,13 @@ rb_method_call_status(rb_thread_t *th, const rb_method_entry_t *me, call_type sc
|
|||
int noex;
|
||||
|
||||
if (UNDEFINED_METHOD_ENTRY_P(me)) {
|
||||
undefined:
|
||||
return scope == CALL_VCALL ? NOEX_VCALL : 0;
|
||||
}
|
||||
if (me->def->type == VM_METHOD_TYPE_REFINED) {
|
||||
me = rb_resolve_refined_method(Qnil, me, NULL);
|
||||
if (UNDEFINED_METHOD_ENTRY_P(me)) goto undefined;
|
||||
}
|
||||
klass = me->klass;
|
||||
oid = me->def->original_id;
|
||||
noex = me->flag;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue