mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_eval.c: follow the original class
* vm_eval.c (vm_call0_body): follow the original class, not to loop the prepended module. [ruby-core:77784] [Bug #12876] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
420b4ae26d
commit
693eabb2be
3 changed files with 20 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Oct 29 09:39:14 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_eval.c (vm_call0_body): follow the original class, not to
|
||||
loop the prepended module. [ruby-core:77784] [Bug #12876]
|
||||
|
||||
Sat Oct 29 00:14:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* enc/trans/windows-1255-tbl.rb: update mapping from 0xCA to
|
||||
|
|
|
@ -530,4 +530,18 @@ class TestSuper < Test::Unit::TestCase
|
|||
|
||||
assert_equal "b", b.new.foo{"c"}
|
||||
end
|
||||
|
||||
def test_public_zsuper_with_prepend
|
||||
bug12876 = '[ruby-core:77784] [Bug #12876]'
|
||||
m = EnvUtil.labeled_module("M")
|
||||
c = EnvUtil.labeled_class("C") {prepend m; public :initialize}
|
||||
o = assert_nothing_raised(Timeout::Error, bug12876) {
|
||||
Timeout.timeout(3) {c.new}
|
||||
}
|
||||
assert_instance_of(c, o)
|
||||
m.module_eval {def initialize; raise "exception in M"; end}
|
||||
assert_raise_with_message(RuntimeError, "exception in M") {
|
||||
c.new
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -201,7 +201,7 @@ vm_call0_body(rb_thread_t* th, struct rb_calling_info *calling, const struct rb_
|
|||
goto again;
|
||||
}
|
||||
|
||||
super_class = RCLASS_SUPER(cc->me->defined_class);
|
||||
super_class = RCLASS_SUPER(RCLASS_ORIGIN(cc->me->defined_class));
|
||||
|
||||
if (!super_class || !(cc->me = rb_callable_method_entry(super_class, ci->mid))) {
|
||||
enum method_missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0;
|
||||
|
|
Loading…
Reference in a new issue