зеркало из https://github.com/github/ruby.git
vm_eval.c: next super class from the original
* vm_eval.c (vm_call_super): search next super class from the original class, to get rid of infinite recursion with prepending. a patch by Seiei Higa <hanachin AT gmail.com> at [ruby-core:68434]. [ruby-core:68093] [Bug #10847] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b81950f480
Коммит
3e557a979e
|
@ -1,3 +1,10 @@
|
|||
Fri Mar 6 10:31:00 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_eval.c (vm_call_super): search next super class from the
|
||||
original class, to get rid of infinite recursion with
|
||||
prepending. a patch by Seiei Higa <hanachin AT gmail.com> at
|
||||
[ruby-core:68434]. [ruby-core:68093] [Bug #10847]
|
||||
|
||||
Fri Mar 6 08:45:26 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* lib/matrix.rb: Add Vector#round. Patch by Jordan Stephens.
|
||||
|
|
|
@ -1748,6 +1748,17 @@ class TestModule < Test::Unit::TestCase
|
|||
assert_equal([m, c2, m, c1], c2.ancestors[0, 4], "should accesisble prepended module in superclass")
|
||||
end
|
||||
|
||||
def test_prepend_call_super
|
||||
assert_separately([], <<-'end;') #do
|
||||
bug10847 = '[ruby-core:68093] [Bug #10847]'
|
||||
module M; end
|
||||
Float.prepend M
|
||||
assert_nothing_raised(SystemStackError, bug10847) do
|
||||
0.3.numerator
|
||||
end
|
||||
end;
|
||||
end
|
||||
|
||||
def test_class_variables
|
||||
m = Module.new
|
||||
m.class_variable_set(:@@foo, 1)
|
||||
|
|
|
@ -273,7 +273,8 @@ vm_call_super(rb_thread_t *th, int argc, const VALUE *argv)
|
|||
rb_bug("vm_call_super: should not be reached");
|
||||
}
|
||||
|
||||
klass = RCLASS_SUPER(cfp->klass);
|
||||
klass = RCLASS_ORIGIN(cfp->klass);
|
||||
klass = RCLASS_SUPER(klass);
|
||||
id = cfp->me->def->original_id;
|
||||
me = rb_method_entry(klass, id, &klass);
|
||||
if (!me) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче