summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--error.c3
-rw-r--r--test/ruby/test_exception.rb8
-rw-r--r--version.h2
3 files changed, 11 insertions, 2 deletions
diff --git a/error.c b/error.c
index 926ec5adb9..a870d0200b 100644
--- a/error.c
+++ b/error.c
@@ -317,7 +317,8 @@ rb_warning_warn(VALUE mod, VALUE str)
static int
rb_warning_warn_arity(void)
{
- return rb_method_entry_arity(rb_method_entry(rb_singleton_class(rb_mWarning), id_warn));
+ const rb_method_entry_t *me = rb_method_entry(rb_singleton_class(rb_mWarning), id_warn);
+ return me ? rb_method_entry_arity(me) : 1;
}
static VALUE
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 67f38c2e91..c8746359fd 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -1200,6 +1200,14 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
assert_empty warning
end
+ def test_undef_Warning_warn
+ assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}")
+ begin;
+ Warning.undef_method(:warn)
+ assert_raise(NoMethodError) { warn "" }
+ end;
+ end
+
def test_undefined_backtrace
assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}")
begin;
diff --git a/version.h b/version.h
index 22b61f81e6..fabee0ba11 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 2
+#define RUBY_PATCHLEVEL 3
#define RUBY_RELEASE_YEAR 2022
#define RUBY_RELEASE_MONTH 1