зеркало из https://github.com/github/ruby.git
* iseq.c (Init_ISeq): undef ISeq.translate and ISeq.load_iseq
to prevent calling super classes' methods. Without this patch, you can write workaround like: class << RubyVM::InstructionSequence def translate; end undef translate end * test/ruby/test_iseq.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
bebb62e01b
Коммит
d8c3672b01
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
Wed Jul 13 14:22:50 2016 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* iseq.c (Init_ISeq): undef ISeq.translate and ISeq.load_iseq
|
||||
to prevent calling super classes' methods.
|
||||
|
||||
Without this patch, you can write workaround like:
|
||||
|
||||
class << RubyVM::InstructionSequence
|
||||
def translate; end
|
||||
undef translate
|
||||
end
|
||||
|
||||
* test/ruby/test_iseq.rb: add a test.
|
||||
|
||||
Wed Jul 13 14:16:03 2016 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* vm_method.c (method_entry_get_without_cache): check
|
||||
|
|
3
iseq.c
3
iseq.c
|
@ -2462,4 +2462,7 @@ Init_ISeq(void)
|
|||
rb_define_singleton_method(rb_cISeq, "disasm", iseqw_s_disasm, 1);
|
||||
rb_define_singleton_method(rb_cISeq, "disassemble", iseqw_s_disasm, 1);
|
||||
rb_define_singleton_method(rb_cISeq, "of", iseqw_s_of, 1);
|
||||
|
||||
rb_undef_method(CLASS_OF(rb_cISeq), "translate");
|
||||
rb_undef_method(CLASS_OF(rb_cISeq), "load_iseq");
|
||||
}
|
||||
|
|
|
@ -235,4 +235,14 @@ class TestISeq < Test::Unit::TestCase
|
|||
end
|
||||
assert_equal([m1, e1.message], [m2, e2.message], feature11951)
|
||||
end
|
||||
|
||||
def test_translate_by_object
|
||||
assert_separately([], <<-"end;")
|
||||
class Object
|
||||
def translate
|
||||
end
|
||||
end
|
||||
assert_equal(0, eval("0"))
|
||||
end;
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче