summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-02-25 13:39:39 +0900
committergit <svn-admin@ruby-lang.org>2022-02-25 19:57:50 +0900
commitbb22bc76b08b8281d888424522790e0227ea09a4 (patch)
tree17021859d77200934dfce7421d9053f4b1e3576f /ext/date
parentd4f32b6b7b6be8c0508cf0e7d50ae7ccd14f555a (diff)
[ruby/date] Deprecate the unintentional ability to parse `Symbol`
https://github.com/ruby/date/commit/d57818f3b3
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/date_core.c10
-rw-r--r--ext/date/extconf.rb1
2 files changed, 10 insertions, 1 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index f6579b81e4..50d46e7a0c 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -4339,11 +4339,19 @@ get_limit(VALUE opt)
return 128;
}
+#ifndef HAVE_RB_CATEGORY_WARN
+#define rb_category_warn(category, fmt) rb_warn(fmt)
+#endif
+
static void
check_limit(VALUE str, VALUE opt)
{
if (NIL_P(str)) return;
- if (SYMBOL_P(str)) str = rb_sym2str(str);
+ if (SYMBOL_P(str)) {
+ rb_category_warn(RB_WARN_CATEGORY_DEPRECATED,
+ "The ability to parse Symbol is an unintentional bug and is deprecated");
+ str = rb_sym2str(str);
+ }
StringValue(str);
size_t slen = RSTRING_LEN(str);
diff --git a/ext/date/extconf.rb b/ext/date/extconf.rb
index f891de403d..358f64173a 100644
--- a/ext/date/extconf.rb
+++ b/ext/date/extconf.rb
@@ -3,6 +3,7 @@ require 'mkmf'
config_string("strict_warnflags") {|w| $warnflags += " #{w}"}
+have_func("rb_category_warn")
with_werror("", {:werror => true}) do |opt, |
have_var("timezone", "time.h", opt)
have_var("altzone", "time.h", opt)