summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--load.c2
-rw-r--r--test/ruby/test_exception.rb21
-rw-r--r--version.h2
3 files changed, 23 insertions, 2 deletions
diff --git a/load.c b/load.c
index e5b0ff435d..3dcc40bbe9 100644
--- a/load.c
+++ b/load.c
@@ -1131,7 +1131,7 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception)
if (ftptr) load_unlock(RSTRING_PTR(path), !state);
if (state) {
- if (state == TAG_FATAL) {
+ if (state == TAG_FATAL || state == TAG_THROW) {
EC_JUMP_TAG(ec, state);
}
else if (exception) {
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 0f3e11b566..6ab72e7954 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -181,6 +181,27 @@ class TestException < Test::Unit::TestCase
}
end
+ def test_catch_throw_in_require_cant_be_rescued
+ bug18562 = '[ruby-core:107403]'
+ Tempfile.create(["dep", ".rb"]) {|t|
+ t.puts("throw :extdep, 42")
+ t.close
+
+ rescue_all = Class.new(Exception)
+ def rescue_all.===(_)
+ raise "should not reach here"
+ end
+
+ v = assert_throw(:extdep, bug18562) do
+ require t.path
+ rescue rescue_all => e
+ assert(false, "should not reach here")
+ end
+
+ assert_equal(42, v, bug18562)
+ }
+ end
+
def test_throw_false
bug12743 = '[ruby-core:77229] [Bug #12743]'
Thread.start {
diff --git a/version.h b/version.h
index a1f784e3fd..f9ff56dbbf 100644
--- a/version.h
+++ b/version.h
@@ -12,7 +12,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 4
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 194
+#define RUBY_PATCHLEVEL 195
#define RUBY_RELEASE_YEAR 2022
#define RUBY_RELEASE_MONTH 3