ruby-changes:43223
From: nobu <ko1@a...>
Date: Mon, 6 Jun 2016 18:38:03 +0900 (JST)
Subject: [ruby-changes:43223] nobu:r55297 (trunk): vm_insnhelper.c: check symbol proc to throw
nobu 2016-06-06 18:37:59 +0900 (Mon, 06 Jun 2016) New Revision: 55297 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55297 Log: vm_insnhelper.c: check symbol proc to throw * vm_insnhelper.c (vm_throw_start): check if the iseq is symbol proc, class definition should not be a symbol proc. [ruby-core:75856] [Bug #12462] Modified files: trunk/ChangeLog trunk/test/ruby/test_symbol.rb trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 55296) +++ ChangeLog (revision 55297) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Jun 6 18:37:57 2016 Nobuyoshi Nakada <nobu@r...> + + * vm_insnhelper.c (vm_throw_start): check if the iseq is symbol + proc, class definition should not be a symbol proc. + [ruby-core:75856] [Bug #12462] + Mon Jun 6 18:36:34 2016 Martin Duerst <duerst@i...> * string.c: Added UTF-16BE/LE and UTF-32BE/LE to supported encodings Index: test/ruby/test_symbol.rb =================================================================== --- test/ruby/test_symbol.rb (revision 55296) +++ test/ruby/test_symbol.rb (revision 55297) @@ -157,6 +157,15 @@ class TestSymbol < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_symbol.rb#L157 assert_equal(1, first, bug11594) end + private def return_from_proc + Proc.new { return 1 }.tap(&:call) + end + + def test_return_from_symbol_proc + bug12462 = '[ruby-core:75856] [Bug #12462]' + assert_equal(1, return_from_proc, bug12462) + end + def test_to_proc_for_hash_each bug11830 = '[ruby-core:72205] [Bug #11830]' assert_normal_exit(<<-'end;', bug11830) # do Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 55296) +++ vm_insnhelper.c (revision 55297) @@ -995,7 +995,9 @@ vm_throw_start(rb_thread_t *const th, rb https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L995 target_lep = lep; } - if (lep == target_lep && escape_cfp->iseq->body->type == ISEQ_TYPE_CLASS) { + if (lep == target_lep && + RUBY_VM_NORMAL_ISEQ_P(escape_cfp->iseq) && + escape_cfp->iseq->body->type == ISEQ_TYPE_CLASS) { in_class_frame = 1; target_lep = 0; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/