Skip to content

Commit 435dfec

Browse files
committed
Remove the unintentional ability to parse Symbol
It's been 2 years since #49, so it's okay.
1 parent 4007df8 commit 435dfec

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

ext/date/date_core.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4464,12 +4464,6 @@ check_limit(VALUE str, VALUE opt)
44644464
{
44654465
size_t slen, limit;
44664466
if (NIL_P(str)) return;
4467-
if (SYMBOL_P(str)) {
4468-
rb_category_warn(RB_WARN_CATEGORY_DEPRECATED,
4469-
"The ability to parse Symbol is an unintentional bug and is deprecated");
4470-
str = rb_sym2str(str);
4471-
}
4472-
44734467
StringValue(str);
44744468
slen = RSTRING_LEN(str);
44754469
limit = get_limit(opt);

test/date/test_date_parse.rb

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,7 @@ def test__iso8601
867867
h = Date._iso8601(nil)
868868
assert_equal({}, h)
869869

870-
h = assert_deprecated_warn {Date._iso8601('01-02-03T04:05:06Z'.to_sym)}
871-
assert_equal([2001, 2, 3, 4, 5, 6, 0],
872-
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
870+
assert_raise(TypeError) {Date._iso8601('01-02-03T04:05:06Z'.to_sym)}
873871
end
874872

875873
def test__rfc3339
@@ -889,9 +887,7 @@ def test__rfc3339
889887
h = Date._rfc3339(nil)
890888
assert_equal({}, h)
891889

892-
h = assert_deprecated_warn {Date._rfc3339('2001-02-03T04:05:06Z'.to_sym)}
893-
assert_equal([2001, 2, 3, 4, 5, 6, 0],
894-
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
890+
assert_raise(TypeError) {Date._rfc3339('2001-02-03T04:05:06Z'.to_sym)}
895891
end
896892

897893
def test__xmlschema
@@ -978,9 +974,7 @@ def test__xmlschema
978974
h = Date._xmlschema(nil)
979975
assert_equal({}, h)
980976

981-
h = assert_deprecated_warn {Date._xmlschema('2001-02-03'.to_sym)}
982-
assert_equal([2001, 2, 3, nil, nil, nil, nil],
983-
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
977+
assert_raise(TypeError) {Date._xmlschema('2001-02-03'.to_sym)}
984978
end
985979

986980
def test__rfc2822
@@ -1017,9 +1011,7 @@ def test__rfc2822
10171011
h = Date._rfc2822(nil)
10181012
assert_equal({}, h)
10191013

1020-
h = assert_deprecated_warn {Date._rfc2822('Sat, 3 Feb 2001 04:05:06 UT'.to_sym)}
1021-
assert_equal([2001, 2, 3, 4, 5, 6, 0],
1022-
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
1014+
assert_raise(TypeError) {Date._rfc2822('Sat, 3 Feb 2001 04:05:06 UT'.to_sym)}
10231015
end
10241016

10251017
def test__httpdate
@@ -1044,9 +1036,7 @@ def test__httpdate
10441036
h = Date._httpdate(nil)
10451037
assert_equal({}, h)
10461038

1047-
h = assert_deprecated_warn {Date._httpdate('Sat, 03 Feb 2001 04:05:06 GMT'.to_sym)}
1048-
assert_equal([2001, 2, 3, 4, 5, 6, 0],
1049-
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
1039+
assert_raise(TypeError) {Date._httpdate('Sat, 03 Feb 2001 04:05:06 GMT'.to_sym)}
10501040
end
10511041

10521042
def test__jisx0301
@@ -1127,9 +1117,7 @@ def test__jisx0301
11271117
h = Date._jisx0301(nil)
11281118
assert_equal({}, h)
11291119

1130-
h = assert_deprecated_warn {Date._jisx0301('H13.02.03T04:05:06.07+0100'.to_sym)}
1131-
assert_equal([2001, 2, 3, 4, 5, 6, 3600],
1132-
h.values_at(:year, :mon, :mday, :hour, :min, :sec, :offset))
1120+
assert_raise(TypeError) {Date._jisx0301('H13.02.03T04:05:06.07+0100'.to_sym)}
11331121
end
11341122

11351123
def test_iso8601

0 commit comments

Comments
 (0)