From ded40392317c885439232de5f7da3519ebce4ee5 Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 17 Oct 2016 18:07:08 +0000 Subject: merge revision(s) 56252,56254: [Backport #12743] * eval_intern.h (TH_PUSH_TAG): Initialize struct rb_vm_tag::tag with Qundef rather than 0 which is equal to Qfalse. Since Kernel#throw(obj) searches a tag with rb_vm_tag::tag == obj, throw(false) can accidentally find an unrelated tag which is not created by Kernel#catch. [ruby-core:77229] [Bug #12743] * test/ruby/test_exception.rb (test_throw_false): Add a test case for this. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_exception.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index b7b6ba4b1e..4a39952465 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -181,6 +181,16 @@ class TestException < Test::Unit::TestCase } end + def test_throw_false + bug12743 = '[ruby-core:77229] [Bug #12743]' + e = assert_raise_with_message(UncaughtThrowError, /false/, bug12743) { + Thread.start { + throw false + }.join + } + assert_same(false, e.tag, bug12743) + end + def test_else_no_exception begin assert(true) -- cgit v1.2.3