ruby-changes:26363
From: nagachika <ko1@a...>
Date: Sun, 16 Dec 2012 00:46:20 +0900 (JST)
Subject: [ruby-changes:26363] nagachika:r38414 (trunk): * cont.c (rb_fiber_start): don't enqueue Qnil to async_errinfo_queue.
nagachika 2012-12-16 00:46:07 +0900 (Sun, 16 Dec 2012) New Revision: 38414 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38414 Log: * cont.c (rb_fiber_start): don't enqueue Qnil to async_errinfo_queue. rb_vm_make_jump_tag_but_local_jump() could return Qnil (ex. when finished by Thread.exit). [ruby-dev:45218] [Bug #5993] * test/ruby/test_fiber.rb (test_exit_in_fiber): add test for it. Modified files: trunk/ChangeLog trunk/cont.c trunk/test/ruby/test_fiber.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38413) +++ ChangeLog (revision 38414) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Dec 16 00:39:43 2012 CHIKANAGA Tomoyuki <nagachika@r...> + + * cont.c (rb_fiber_start): don't enqueue Qnil to async_errinfo_queue. + rb_vm_make_jump_tag_but_local_jump() could return Qnil (ex. when + finished by Thread.exit). [ruby-dev:45218] [Bug #5993] + + * test/ruby/test_fiber.rb (test_exit_in_fiber): add test for it. + Sat Dec 15 23:56:51 2012 Naohisa Goto <ngotogenome@g...> * ext/fiddle/pointer.c (rb_fiddle_ptr2cptr): fix error message Index: cont.c =================================================================== --- cont.c (revision 38413) +++ cont.c (revision 38414) @@ -1174,7 +1174,8 @@ rb_fiber_start(void) https://github.com/ruby/ruby/blob/trunk/cont.c#L1174 } else { VALUE err = rb_vm_make_jump_tag_but_local_jump(state, th->errinfo); - rb_threadptr_async_errinfo_enque(th, err); + if (!NIL_P(err)) + rb_threadptr_async_errinfo_enque(th, err); } RUBY_VM_SET_INTERRUPT(th); } Index: test/ruby/test_fiber.rb =================================================================== --- test/ruby/test_fiber.rb (revision 38413) +++ test/ruby/test_fiber.rb (revision 38414) @@ -262,5 +262,12 @@ class TestFiber < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_fiber.rb#L262 assert_equal(0, status.exitstatus, bug5700) assert_equal(false, status.signaled?, bug5700) end + + def test_exit_in_fiber + bug5993 = '[ruby-dev:45218]' + assert_nothing_raised(bug5993) do + Thread.new{ Fiber.new{ Thread.exit }.resume }.join + end + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/