From 54619f8d1e1c582b989bb910c2f5dadfde2d530b Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 15 Dec 2012 15:46:07 +0000 Subject: * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ cont.c | 3 ++- test/ruby/test_fiber.rb | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a95c85b46b..ce7b404b3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Dec 16 00:39:43 2012 CHIKANAGA Tomoyuki + + * 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 * ext/fiddle/pointer.c (rb_fiddle_ptr2cptr): fix error message diff --git a/cont.c b/cont.c index 01800a6016..be8c982228 100644 --- a/cont.c +++ b/cont.c @@ -1174,7 +1174,8 @@ rb_fiber_start(void) } 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); } diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index 611b119033..7f15e74118 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -262,5 +262,12 @@ class TestFiber < Test::Unit::TestCase 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 -- cgit v1.2.3