[前][次][番号順一覧][スレッド一覧]

ruby-changes:71673

From: NAKAMURA <ko1@a...>
Date: Thu, 7 Apr 2022 22:52:53 +0900 (JST)
Subject: [ruby-changes:71673] ea9b0fe5d3 (ruby_2_7): merge revision(s) ae5458f228a5477383e9c00425d85d50a3867817: [Backport #18475]

https://git.ruby-lang.org/ruby.git/commit/?id=ea9b0fe5d3

From ea9b0fe5d30efaa7dad1be4da79c1ee58f4f963b Mon Sep 17 00:00:00 2001
From: NAKAMURA Usaku <usa@r...>
Date: Sat, 19 Mar 2022 22:15:40 +0900
Subject: merge revision(s) ae5458f228a5477383e9c00425d85d50a3867817: [Backport
 #18475]

    thread.c: Convert TAG_BREAK to a normal exception at thread top-level

    [Bug #18475]
    ---
     test/ruby/test_enum.rb | 11 +++++++++++
     thread.c               |  3 +++
     2 files changed, 14 insertions(+)
---
 test/ruby/test_enum.rb | 11 +++++++++++
 thread.c               |  4 ++++
 version.h              |  4 ++--
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index 9f6f19b669..ef732b9924 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -326,6 +326,17 @@ class TestEnumerable < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_enum.rb#L326
       empty.first
       empty.block.call
     end;
+
+    bug18475 = '[ruby-dev:107059]'
+    assert_in_out_err([], <<-'end;', [], /unexpected break/, bug18475)
+      e = Enumerator.new do |g|
+        Thread.new do
+          g << 1
+        end.join
+      end
+
+      e.first
+    end;
   end
 
   def test_sort
diff --git a/thread.c b/thread.c
index 90883b4cff..be6b46b155 100644
--- a/thread.c
+++ b/thread.c
@@ -741,6 +741,10 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start) https://github.com/ruby/ruby/blob/trunk/thread.c#L741
 	}
 	else {
 	    errinfo = th->ec->errinfo;
+
+            VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, Qundef);
+            if (!NIL_P(exc)) errinfo = exc;
+
 	    if (state == TAG_FATAL) {
 		/* fatal error within this thread, need to stop whole script */
 	    }
diff --git a/version.h b/version.h
index e350891f18..f423165c28 100644
--- a/version.h
+++ b/version.h
@@ -2,11 +2,11 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L2
 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
 #define RUBY_VERSION_TEENY 6
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 211
+#define RUBY_PATCHLEVEL 212
 
 #define RUBY_RELEASE_YEAR 2022
 #define RUBY_RELEASE_MONTH 3
-#define RUBY_RELEASE_DAY 5
+#define RUBY_RELEASE_DAY 19
 
 #include "ruby/version.h"
 
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]