diff options
-rw-r--r-- | eval.c | 1 | ||||
-rw-r--r-- | test/ruby/test_beginendblock.rb | 22 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 24 insertions, 1 deletions
@@ -173,6 +173,7 @@ ruby_cleanup(volatile int ex) step_0: step++; errs[1] = th->errinfo; + if (THROW_DATA_P(th->errinfo)) th->errinfo = Qnil; th->safe_level = 0; ruby_init_stack(&errs[STACK_UPPER(errs, 0, 1)]); diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb index a09c963b3c..4c00c43a0b 100644 --- a/test/ruby/test_beginendblock.rb +++ b/test/ruby/test_beginendblock.rb @@ -148,4 +148,26 @@ EOS end end; end + + if defined?(fork) + def test_internal_errinfo_at_exit + # TODO: use other than break-in-fork to throw an internal + # error info. + error, pid, status = IO.pipe do |r, w| + pid = fork do + r.close + STDERR.reopen(w) + at_exit do + $!.class + end + break + end + w.close + [r.read, *Process.wait2(pid)] + end + assert_not_predicate(status, :success?) + assert_not_predicate(status, :signaled?) + assert_match(/unexpected break/, error) + end + end end @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.4.6" #define RUBY_RELEASE_DATE "2019-03-31" -#define RUBY_PATCHLEVEL 353 +#define RUBY_PATCHLEVEL 354 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 3 |